by kergonath · 5y ago · 0 comments
Once the pipeline is set, Python is for scripts that need to be run more than about a dozen times, or need to be run on several datasets, or for things that need to be reproduced exactly (like stuff that goes into a paper). I also use it to prepare datasets from large numbers of calculations where the useful results need to be gathered from dozens/hundreds of files in a more or less complex file structure, often on different computers, with the occasional pass with some post-processing tools.
I really dislike Matplotlib, so rendering is done in something else, usually gnuplot.
That’s for my stuff (mostly atomic-scale modelling and quantum chemistry in materials science), it might be different for other use cases...
That said I may use matplotlib much less than you do (I used it a lot when I was a student, now maybe 6 times a year).
This! My biggest gripe against Python numerical stuff was matplotlib, until I realized that it is an entirely optional component of the stack, and you can plot by other, much saner means.
If I'm using Matplotlib, I'm almost always plotting things calculated in Python, so all my data and variables are right there ready to go. I think the fine details are controllable in more programmatic ways than Gnuplot. I use other Python libraries when they're a better fit. Being Python and object oriented makes it easy to figure out how to do many things (e.g. autocomplete).
If I'm doing one-off throwaway plots, there are better and easier tools than Gnuplot: Desmos, GeoGebra.
If I'm making interactive demos, there are better tools than Gnuplot: Desmos, GeoGebra, JSXGraph, Jupyter.
If I'm plotting a function for a high-quality PDF document, TikZ gives me more control than Gnuplot, and makes it easy to make many plots with consistent (and changeable) style, though being a Latex-based tool it has limitations to go with its power. TikZ is great for diagrams too. Asymptote is more powerful than TikZ in some ways for this kind of thing, but often harder to use.
I'm glad I'm not alone. I was starting to feel crazy—how can something with this bad an API (Matplotlib) be this popular in the Python ecosystem which is known for its lack of verbosity and clarity? How can it be integrated with every other package instead of some sane alternative?
I tried Seaborn (a wrapper effectively), and it is way better for doing basic plots. But as soon as you get beyond that you're back in arcane Matplotlib territory. The best thing I could have done would have been to ignore its integrations and start with a better plotting API to begin with. The little bit of extra integration effort would have been worth avoiding Matplotlib. And there are several alternatives in the Python landscape.
No offense to the authors—it's clear they've done a lot of great work. But I think they got stuck with a bad API that they started with and it became so common-place that they were forced to continually be backwards compatible with something that really needed an overhaul.
I honestly moved on to gui based plotting programs like grace or veusz, there's just a button for the things you want to do
(I think matplotlib has an openGL backend that slightly improves but doesn't fix the issues with matplotlibs handling of large datasets)