Show HN: MPL Plotter – Python library to make technical plots more efficiently
github.com
github.com
I don't think I need to give anyone reasons why it sucks, but the reason it's going to be hard to replace is that it can do so much. You can make other plotting libraries that are way easier to do a small subset of things with, but as soon as you want strange, lower level, customizable things, you start having to build in little hacks and workarounds. If you have enough of these, you'll eventually get mpl.
I wanted to draw something I thought would be simple using matplotlib or seaborn. The components were themselves pretty standard:
1. A combo chart (two y variables: one as a line, one as vertical bars).
2. A facet grid (multiple charts with the same axis definition, with each chart representing a slice of the data).
#1 is easy in Excel
#2 is easy in Matplotlib
So I thought the combination of the two would be easy in Matplotlib. At first, it wasn't easy.
It turns out that, if you try and learn matplotlib by googling examples as and when you need them, you may not build a good mental model of how matplotlib charts work. So you hit a wall when you try to do something for which there's no good example online.
But if you read the documentation (particularly the page linked above), things get much easier and the frustration melts away.
Similarly things like traditional x/y plots with a centre axis with arrows are much harder than they should be (it can be done but is really quite a bit of hassle).
And there are lots of other, similar issues. I suspect the OP is correct and it will be very difficult to replace mpl for producing publish quality plots (I think for interactive plots it's much easier and already done), despite it's shortcomings, because it is so powerful.
I occasionally (once every 4 months or so) have to create some plots for reports or analysis, and they are almost always very weird, dissimilar to previous plots. It always ends up being a huge pain, even if sometime in the past I've done something kind of like them (this is especially true for any kind of dynamic plots).
I've ended up building a pretty easy to modify plotting suite out of DearPyGui. I cannot recommend DPG enough, especially for high throughput or large scale plots. Immediate mode programming is a joy to work with, and it's pretty awesome being able to quickly toggle on and off any dataset in realtime.
It saves me quite some time, so I guessed I might as well share it :)
All feedback is welcome! It's my first library so there's quite a lot of room to grow. Thanks in advance for checking it out!
1. How does it compare to seaborne? (https://seaborn.pydata.org/)
2. Any tips for plotting large amounts of data with matplotlib?
I think when most people complain about 'matplotlib not being efficient' (or whatever), they're talking about the time it takes to hammer out the plot, not necessarily the render time (unless they're trying to do animations...)
Datashader can handle some pretty big sets. https://datashader.org/
To add some more depth to the Seaborn comparison, and not being an expert Seaborn user, I'd say:
1. MPL Plotter is lighter (but also with less wide-ranging plot options) 2. In my experience, MPL Plotter's presets (most importantly, the defaults from which you build your plots up) are more suitable for technical papers than Seaborn's.
And perhaps a bit more arguably (again, I'm not a Seaborn expert, please do correct me if you think otherwise):
3. I believe MPL Plotter gives you more fine-grained control over your plot. That's is for you to plot and customize as far as Matplotlib will take you in one line, while most Seaborn examples I've seen use pyplot snippets. 4. And following with the above, I believe the syntax is a little more concise.
Personally I like that MPL Plotter is fundamentally Matplotlib, so I can use any Matplotlib customization I might need seamlessly, and, if useful enough, add it later on as a method in MPL Plotter itself, which would be a bit harder on such an established project as Seaborn. It's just tastes at that point, and the flexibility of being a small project.
Cheers!
> The API might change, and the defaults might not be your cup of tea
Changing the API meaning I have to rewrite my code ? This is a huge burden.