From: Eric Firing <efiring@ha...> - 2007-09-10 02:06:46
The pylab namespace has gradually gotten messier and messier, with all
sorts of things dumped into it. A number of people have asked for a
smaller module that would contain only the state-machine plotting part
of pylab--that is, the figure, show, plot, contour, etc. sorts of
functions. The name "pyplot" was suggested. I have made a first cut at
this in svn, and I hope interested people will take a look and try it
out. Here are the changes:
1) pylab is still present as a namespace aggregator, importing things
from numpy and pyplot. So as to avoid breaking existing code that uses
it, I have kept the numpy.oldnumeric imports rather than importing from
numpy itself, but it is done explicitly rather than via numerix. We
will want to make a transition away from oldnumeric, but I did not want
to force that immediately. The present pylab should work like the old
one, except that I removed a few redundant imports. It is possible that
some user code was using them and will therefore fail, but I expect such
cases, if any, to be rare and easy to fix.
2) matplotlib.pyplot has all the basic function-based plotting and
global things like rc and rcParams. If you want a fully modern version
of pylab in interactive mode, then instead of
from pylab import *
you would do
from numpy import *
from matplotlib.pyplot import *
The latter may be what pylab itself evolves into.
Note that although pylab.py gets installed as a top-level module,
pyplot does not; you have to qualify it with "matplotlib".
pyplot imports a number of classes from matplotlib in addition to the
basic functions. If there is a consensus that this should not be
done--that pyplot should be a smaller and cleaner namespace--it would be
easy to take out those imports.
I have not written a docstring for pyplot.py yet. I will do that once
it has been checked out and the design has settled down.
Get latest updates about Open Source Projects, Conferences and News.