matplotlib |
2009-06-05
|
Is python's matplotlib and pylab just a twisty little maze of global variables and mass imports, making it impossible to learn your way around by introspection ? Or is it me ?
I am getting lost in the difference between Axes, figure()'s and plot()'s...
I'm sure this would all make more sense to me if I could recall my vague Matlab knowledge from university.
It’s a bit awkward, but it works well enough. Are you trying to figure out how to use it or hack it?
Comment by Bryan — 2009-06-05 @ 16:19
pylab pulls all sorts into it’s namespace. This is intended for convenient interactive use. matplotlib.pyplot contains the same plotting functions as pylab, but doesn’t pollute the namespace with numpy functions and other stuff.
For more structured development, you may be better off using the object-oriented core API. Most of the plotting functions in the pylab module map onto the methods of Axes objects.
Comment by BC — 2009-06-05 @ 16:58
Yes, matplotlib can be very daunting. I’m maintaining a project written by someone who was new to both Python and Matplotlib. He did an amazing job doing some OO wrapping about calls to gcf() and other ugly non-OO stuff. If he had seen the OO interface, we might have some cleaner code. :)
Axes are the x/y things on which you plot values, graphs are an instance of values plotted on axes, and a figure can contain one or more graphs.
BTW, if you’re not too heavily invested, take a look at Chaco: http://code.enthought.com/chaco/ Very OO interace, and makes some pretty graphs.
Comment by Joshua Kugler — 2009-06-05 @ 20:06
matplotlib definetly needs better documentation, but it does work quite nicely once you manage to get around to doing something.
As for plotting with the OO core API, is there a good tutorial/introduction about that anywhere?
Comment by Marcus — 2009-06-05 @ 22:58
@Bryan: use it, really. Slowly learning my way around.
@Joshua: chaco looks interesting, and since I just started with matplotlib, I might switch.
Comment by Thomas — 2009-06-06 @ 10:51
Agreed, its high time we get a better graphing library in linux, imho….
Comment by Kevin DuBois — 2009-06-08 @ 14:13