python 矢量图形库_在python中有没有一种有效的方法将2D图存储为矢量图形?

下面是我在评论中建议的答案:

大的pdf/svg文件是将pcolormesh中的每个矩形存储为矢量图形的结果。在

我希望将绘图存储为svg/pdf的目的是获得一个高分辨率的图像,在该图像中,一旦我将文件插入到我的latex文档中,文本就会呈现出来。如果分辨率足够好,绘图本身并不需要是矢量图形。在

所以我的建议是(导入的库和上面一样):mpl.use('svg')

new_rc_params = {

"font.family": 'Times', #probably python doesn't know Times, but it will replace it with a different font anyway. The final decision is up to the latex document anyway

"font.size": 12, #choosing the font size helps latex to place all the labels, ticks etc. in the right place

"font.serif": [],

"svg.fonttype": 'none'} #to store text as text, not as path

mpl.rcParams.update(new_rc_params)

plt.figure(figsize = (6.49/2, 6.49/2)) #that's about half the text width of an A4 document

plt.pcolormesh(x, y, z, rasterized = True) # That's the

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值