Creating publication-quality figures with Matplotlib
1–10 of 15 posts
Re: Creating publication-quality figures with Matplotlib
#2Re: Creating publication-quality figures with Matplotlib
#3Re: Creating publication-quality figures with Matplotlib
#4rc('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.
Re: Creating publication-quality figures with Matplotlib
#5I 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/journ…
Re: Creating publication-quality figures with Matplotlib
#6They look good, but the amount of code is staggering!
Re: Creating publication-quality figures with Matplotlib
#7They look good, but the amount of code is staggering!
MPL is relatively complete, but it has been one of the worst libraries for plotting that I've ever used. You can make nice plots with it, but you can do the same using most of the other libraries as well.
It's terribly inefficient when used with the OO interface, which is allegedly the "way to go". But in reality it's so verbose, that almost everybody is using the pylab wrapper at least in parts to reduce the boilerplate you need. Not to mention that the pylab wrapper in itself is a very crappy compromise with a lot of state. I never used Matlab, but I certainly know that I don't like the way it works.
Even basic stuff, like the ability to customize/cycle the color of the series in a central place (which is key to being able to use palettes efficiently) is not there. You need to supply color values manually!
I routinely use a lot of plotting programs, but despite its shortcomings I keep reaching "gnuplot" very often. The syntax is arcane, but gets the job done quickly. You can customize the plot in a few commands, and often a simple ~/.gnuplotrc with a few defaults can make the plots look identical to MPL.
The "publication quality" is a red herring. What makes the plot publication quality is not the software. As long as it renders with AA or at 300 dpi, you can get the same output from most of the plotting packages.
Now, speaking about plotting packages, I've been using 'seaborn' a lot recently, which helps in reducing the clutter you need around MPL. Unfortunately, like most of the packages that just wraps core functionality, it's sometimes impossible to customize the plots the way you need. For example, you cannot get decent B/W plots, since you cannot customize the line types (again, missing functionality from MPL which should be core). The same on gnuplot takes 2 seconds. You would think that plotting in B/W should be common, given that often you need to pay extra to publish color figures, and this clashes a bit in the "publication quality" issue, which seaborn also claims.
A package in pythonland that shows promise is yhat/ggplot, which is a copy of the former package in R. I'm not superfond of the ggplot way of plotting: it requires a lot of data alignment before you can use it effectively (contrast this to seaborn/gnuplot, which also lets you plot any series without much fuss). But it's already way better than plain MPL.
Unfortunately mastering a plotting package takes a long time. I'm curious about impressions about alternative plotting packages to python, geared at figures (so excluding interactive/javascript/web based plotting backends).
Re: Creating publication-quality figures with Matplotlib
#8I 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/journ…
Re: Creating publication-quality figures with Matplotlib
#9They look good, but the amount of code is staggering!
Re: Creating publication-quality figures with Matplotlib
#10It plays nicely with pandas dataframes and has a number of useful built-in plots.
http://stanford.edu/~mwaskom/software/seaborn/ http://stanford.edu/~mwaskom/software/seaborn/tutorial/plott... http://stanford.edu/~mwaskom/software/seaborn/tutorial/times...