Matplotlib is worth using, but it’s very finicky, and the defaults are aimed at
a class of user that doesn’t include me.
MATLAB style with pyplot
I started with the simple declarative style via matplotlib.pyplot, but that quickly
gets limited. It looks like this:
For example, without the useOffset=False bit, my X axis was numbered 0-5 with
an offset written above it, rathern than 2012-2017 as I intended. I suppose this is
useful for scientific plots. I spent 30 minutes combing through documentation trying
to figure this out before resorting to StackOverflow. Similarly, I had to use other
StackOverflow entries to tell me how to write the graph as a file and not to show
it in an interactive window. Again, I’m not the target audience.
This is the right way for me, I think. Note that the code example above had to dip
into the object layer anyway, in order to configure the X axis.
One cool thing is that someone made an xkcd style for Matplotlib. Just wrap your
code in this:
and your graphics will have that hand-drawn xkcd style applied to them.
Here is the example from the Matplotlib docs
I wish Matplotlib learned more lessons from Leland Wilkinson’s Grammar of Graphics.