栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

将SVG文件导入Matplotlib图

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

将SVG文件导入Matplotlib图

也许您正在寻找的是svgutils

import svgutils.compose as scfrom IPython.display import SVG # /! note the 'SVG' function also in svgutils.composeimport numpy as np# drawing a random figure on top of your SVGfig, ax = plt.subplots(1, figsize=(4,4))ax.plot(np.sin(np.linspace(0,2.*np.pi)), np.cos(np.linspace(0,2.*np.pi)), 'k--', lw=2.)ax.plot(np.random.randn(20)*.3, np.random.randn(20)*.3, 'ro', label='random sampling')ax.legend()ax2 = plt.axes([.2, .2, .2, .2])ax2.bar([0,1], [70,30])plt.xticks([0.5,1.5], ['water  ', ' ground'])plt.yticks([0,50])plt.title('ratio (%)')fig.savefig('cover.svg', transparent=True)# here starts the assembling using svgutils sc.Figure("8cm", "8cm",     sc.Panel(sc.SVG("./Worldmap_northern.svg").scale(0.405).move(36,29)),    sc.Panel(sc.SVG("cover.svg"))    ).save("compose.svg")SVG('compose.svg')


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/669261.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号