Related: include SVG in LaTeX
from matplotlib.pyplot import figure, draw data = [1,2,3,4] fg = figure() ax = fg.gca() ax.plot(data) draw() # necessary to render figure before saving fg.savefig('myfig.svg', bbox_inches='tight')
SVG vs. EPS vs. PNG
These comments are particularly applicable for LaTeX documents for journal publication, where high-resolution figures are vital.
- vector graphics (SVG or EPS) allow nearly infinite zooming without loss of quality–excellent for line plots and contour plots
- SVG is viewable by any web browser