MatPlotLib.MatLab troubles (how to install/run matplotlib.PyLab?)

D

Dr. Colombes

On my home laptop computer, I'm trying to install the appropriate
modules so that Python version 2.3.3 and IDLE version 1.0.2 (with an
"import matplotlib.matlab" statement) can produce nice MatLab-like
plots.

I have a matplotlib.matlab-capable Python set-up running OK on my
office desktop, which I obtained after downloading and installing a few
more modules (numarray and numeric, I think).

Now I get the following message about matplotlib.matlab being
deprecated:

-------------

matplotlib.matlab deprecated, please import matplotlib.pylab or simply
pylab instead. See http://matplotlib.sf.net/matplotlib_to_pylab.py
for a script which explains this change and will automatically convert
your python scripts that use matplotlib.matlab. This change was made
because we were concerned about trademark infringement on The
Mathwork's trademark of matlab.
 
J

John Hunter

Colombes> matplotlib.matlab deprecated, please import
Colombes> matplotlib.pylab or simply pylab instead. See
Colombes> http://matplotlib.sf.net/matplotlib_to_pylab.py for a
Colombes> script which explains this change and will automatically
Colombes> convert your python scripts that use matplotlib.matlab.
Colombes> This change was made because we were concerned about
Colombes> trademark infringement on The Mathwork's trademark of
Colombes> matlab.

Colombes> Unfortunately, the above URL does not exist.

Oops -- that should be
http://matplotlib.sourceforge.net/matlab_to_pylab.py

In a nutshell, wherever you previously imported matplotlib.matlab you
can import matplotlib.pylab or equivalently, simply pylab

OLD:
from matplotlib.matlab import plot

NEW:
from pylab import plot

The script linked above will recursively search and replace these
strings for you in your scripts directory.

JDH
 
D

Dr. Colombes

John said:
Colombes> matplotlib.matlab deprecated, please import
Colombes> matplotlib.pylab or simply pylab instead. See
Colombes> http://matplotlib.sf.net/matplotlib_to_pylab.py for a
Colombes> script which explains this change and will automatically
Colombes> convert your python scripts that use matplotlib.matlab.
Colombes> This change was made because we were concerned about
Colombes> trademark infringement on The Mathwork's trademark of
Colombes> matlab.

Colombes> Unfortunately, the above URL does not exist.

Oops -- that should be
http://matplotlib.sourceforge.net/matlab_to_pylab.py

In a nutshell, wherever you previously imported matplotlib.matlab you
can import matplotlib.pylab or equivalently, simply pylab

OLD:
from matplotlib.matlab import plot

NEW:
from pylab import plot

The script linked above will recursively search and replace these
strings for you in your scripts directory.

JDH


John:

Thanks for the help with the MatLab --> PyLab conversion.

Now I only need to figure out how to install the correct "Numeric"
module(s). I'm making progress, almost have my home laptop fully
capable with the MatLab-like (PyLab) graphs, plots.
 
J

John Hunter

Colombes> Now I only need to figure out how to install the
Colombes> correct "Numeric" module(s). I'm making progress,
Colombes> almost have my home laptop fully capable with the
Colombes> MatLab-like (PyLab) graphs, plots.

You can get either Numeric or numarray from
http://sourceforge.net/projects/numpy. matplotlib works transparently
with either (and provides a unified interface to both), but if you
choose numarray you need to change the "numerix" variable to numarray
in your matplotlib configuration file, which is described at
http://matplotlib.sf.net/.matplotlibrc

Good luck!
JDH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,221
Messages
2,571,131
Members
47,747
Latest member
swapote

Latest Threads

Top