Skip to content

Comment on Creating publication-quality figures with Matplotlib

Comments

I use Matplotlib for my publications written in latex. Matplotlib can also render via a latex backend, which gives you then matching fonts and symbols in the text and figure by using something as simple as:

rc('text', usetex=True) matplotlib.rcParams['text.latex.preamble'] = ['\\usepackage{siunitx}']

Here is an example from my own publication, with 100% Matplotlib and latex:

http://scitation.aip.org/content/aip/journal/apl/104/9/10.10...

A clear advantage using Matplotlib is reusability as opposed to the time needed to set the plotting parameters right for every single figure over and over. I would really recommend this kind of workflow to anyone in academic publishing.

Can you post a link that is not behind a $28 paywall for having to look at an example?

I found pgfplots delivers great results for plots in academic papers written in latex and also enables reusability. You can reuse templates for similar plots and simply switch out the .csv file containing the data.

Another way to do this (if one wants all plots to be rendered throug LaTeX) is to modifiy the matplotlibrc to include:

  text.usetex         : True
And something similar for the text.latex.preamble section.
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.