matplotlib: generating vector plot

pvl picture pvl · Feb 13, 2012 · Viewed 42.1k times · Source

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

and finally:

myfig.savefig('myfig.eps', format='eps')

I've found that export to ps gives a vector image, but the problem with eps remains.

Answer

hurrial picture hurrial · Oct 17, 2014

I use the following code:

from matplotlib import pyplot as plt

fig, ax = plt.subplots() # or 
fig.savefig('filename.eps', format='eps')