Matplotlib belongs to the worst category of software: very powerful and very awful. Nothing makes any sense and it’s so profoundly unintuitive it almost feels like I’m being pranked. But, of course, use it I must.<p>Pandas also comes off as an unintuitive joke, but my displeasure with it has <i>mostly</i> worn off. Matplotlib however makes me feel angry pretty much everyday.
Matplotlib is verbose, and has had an inconsistent API in the past (v3 has improved this a lot), but if you need to produce publication-quality figures using Python, taking the time to get comfortable with it pays off. I've been using it to produce maps and data visualisations for years – when I finally figure out how to make something look good, I put the notebook on Github, both for my own reference, and for others: <a href="https://github.com/urschrei/Geopython" rel="nofollow">https://github.com/urschrei/Geopython</a>
This post is great---even just explaining the difference between figure and axis, and the multiple systems (and the wise recommendation to use the OO system), and all the rest is gold---that stuff took me days of beating my head against the wall and searching through the matplotlib documentation to sort out.<p>Honestly, for 99% of uses Seaborn is great, so long as you remember to use the latest version---for some reason, a lot of people seem to have 0.8.0 installed, and the api changed with 0.9.0.<p>For uses beyond what Seaborn can do, I think that the best strategy is just to figure out a personal plotting language and then wrap that up into a personal library so you never have to think about that again. That's kind what I've done: I threw together a library to produce some basic figures that are suitable for printing,[1] and now I never have to think about those figures again.<p>[1] <a href="https://github.com/paultopia/plottyprint" rel="nofollow">https://github.com/paultopia/plottyprint</a>
Matplotlib is one of the most user-unfriendly libraries I've had the displeasure to use. The most effective thing to do is to not use it at all.<p>If you can get away with it use pandas' plot, seaborn, altair, etc.
I agree with the basic premise: matplotlib is sort of lousy to use, and annoying to learn, but it works and does everything you might need. There’s something to say about software that solves a problem
I’m a long term Matlab user and I’ve been using Matplotlib more and more recently. This is partially out of frustration with recent changes to Matlab graphics and also a desire to use more open source tools.<p>Matlab plotting is extremely powerful and versatile. Sometimes the output could be nicer but the interactive figure hierarchy is great. Matplotlib on the other hand is, at least to me, a lot more clunky to work with. But it gets the job done and the output often looks nicer and solves my gripes with Matlab.
What is the state of the art in Python data visualisation compared to ggplot2 in R? Over the last few years I have gone exclusively with ggplot2 because it seems so intuitive and customisable.
Another crucial tip if you do a lot of custom drawing, is to use collections instead of calling draw functions per object. This radically speeds up drawing. For example using PolyCollection to draw a big bunch of polygons, then LineCollection, EllipseCollection etc.
I've learned to love matplotlib and its OO interface.<p>I just wish that its documentation examples would consistently provide the OO interface version of how to achieve each example, at least alongside the state-machine version.<p>It's always frustrating to see an example image that shows exactly what I want to achieve, and then click on the code for it and it's using the other interface, and I have to try to guess the equivalent OO commands. Which are always slightly different, like set_ylabel instead of ylabel...
I don’t mind matplotlib but I highly recommend trying to use seaborn over it for anything.<p>Specifically seaborn’s catplot (for categorical), lmplot, swarmplot, pairgrid, and facetgrid.<p>The seaborne gallery really has an extra level of expressiveness that you might not have considered as an amateur visualizer and you can make some very nice things.<p>Matplot lib runs underneath it so you’ll need to learn all of the adjustment functions: lim, figsize, ticks, etc. but I think it’s fine overall.<p>Charts are hard because there’s more depth than people realize and if the library wasn’t deep you’d be unable to express that depth.