I can write some fairly decent Python code. In fact, I’ve recently
written 400-500 lines often using numpy. There are still a number of
concepts that are fuzzy. I have a modest familiarity of OOP from years
ago with C++, and a few things I’ve picked up from Python. Five years
ago, I was working with Matlab, but my knowledge has diminished.
Nevertheless, I finally decided to graphics, MPL, to display what I’m
doing. I’ve had some modest success using very basic operations,
sometime guessing at usage along the way. I’ve looked through the
bewildering array of MPL, pylab, pyplot docs and examples. It’s
slowly fitting together. I decided to give the following web page a
closer look to see what are the differences between the MPL players.
copied a few paragraphs at the start of the FAQ below.
I’ve studied it fairly carefully, and more or less comprehend it.
However, why does it need words like state-machine, convenience
functions, and object-oriented. I’m familiar with them all, but the
concepts really aren’t presented clearly in relationship to the code
below. I’m not even sure if we are pro-pylab or pyplot as the
preferred-style. What part of some of the code is pyplot or otherwise?
Highlight it. Not everyone is clear on some of the assumed Python
It seems as though Python has a way of aligning itself with other
tools, For example, Matlab and Tk. Despite the apparent appeal of MPL
and Tkinter, seldom, maybe never, is anyone who is attracted to these
ideas really familiar with the tools on which they are based. (Perhaps
its the other way. Everyone knows them )Yet no explanation is
offered. What would that take, 3 pages each? ============================================
So, why do all the extra typing required as one moves away from…
Matplotlib, pylab, and pyplot: how are they related?¶
Pyplot provides a Matlab-style state-machine interface to
the underlying object-oriented plotting library in matplotlib.
Pylab combines the pyplot functionality (for plotting) with the
functionality (for mathematics and for working with arrays)
in a single namespace, making that namespace
(or environment) even more Matlab-like. This is what you get if
you use the
ipython shell with the -pylab option, which imports
from pylab and makes plotting fully interactive.
And using pyplot convenience functions, but object-orientation for
import matplotlib.pyplot as plt import numpy as np x = np.arange(0, 10, 0.2) y = np.sin(x) fig = plt.figure() ax = fig.add_subplot(111) ax.plot(x, y) plt.show()
My life in two words. “Interrupted Projects.” – WTW (quote originator)