A note on Matplotlib (and maybe other plotting software)

Author: Paulo van Breugel
Updated on: 20-07-17


If you are making your own plots in Matplotlib, you have the option of saving directly to SVG. However, results may not always be good. The problems are usually font related, or lines not being clipped correctly.


As a work around, you may get more consistent results when you first save the plot to PDF and then run pdf2svg on the file. You can do this directly from Python:

#...generate plot...
os.system('pdf2svg fig.pdf fig.svg')

If your other plotting software has the option to save to SVG but seems to be encountering problems, check if this doesn’t resolve things.


I got this tip from the blogpost kickass-presentations. Check out the blog article for some ideas and tips on "how to make a kickass scientific presentation with LibreOffice and other free tools.


Software: @pdf2svg @python @Matplotlib
Subject: @plotting @visualization @export @conversion

If you have questions

If you have questions or comments about the text, let me know. You can use this contact form. Please make sure to include the page title ("A note on Matplotlib (and maybe other plotting software)") or page name ("from-pdf-to-svg").