本文介绍了matplotlib:生成矢量图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用 matplotlib 生成矢量图.我努力了 - 但输出是一个光栅图像.这是我使用的:
I want to generate a vector plot with matplotlib. I tried hard - but the output is a raster image. Here's what I use:
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
最后:
myfig.savefig('myfig.eps', format='eps')
我发现导出到 ps
会给出一个矢量图像,但是 eps
的问题仍然存在.
I've found that export to ps
gives a vector image, but the problem with eps
remains.
推荐答案
我使用以下代码:
from matplotlib import pyplot as plt
fig, ax = plt.subplots() # or
fig.savefig('filename.eps', format='eps')
这篇关于matplotlib:生成矢量图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!