|
From: John W. <jd...@go...> - 2003-11-21 23:18:57
|
I ended up downloading the latest CVS using the command
cvs -z3 -d:pserver:ano...@cv...:/cvsroot/matplotlib co
matplotlib
and doing python setup.py install
Now when I run my application (which worked with version 0.32) I get
this error on startup
Traceback (most recent call last):
File "./mptwt.py", line 3, in ?
from mp_win import *
File "./mp_win.py", line 10, in ?
from matplotlib.matlab import *
File "/usr/lib/python2.2/site-packages/matplotlib/matlab.py", line 121,
in ?
from axes import Subplot, Axes
File "/usr/lib/python2.2/site-packages/matplotlib/axes.py", line 118, in ?
import backends
File "/usr/lib/python2.2/site-packages/matplotlib/backends/__init__.py",
line 21, in ?
from backend_wx import AxisText, Figure, FigureManager, Gcf, \
File
"/usr/lib/python2.2/site-packages/matplotlib/backends/backend_wx.py",
line 164, in ?
from matplotlib._matlab_helpers import FigureManagerBase, GcfBase
ImportError: cannot import name FigureManagerBase
Am I doing something wrong? I guess I'll go back to version 0.32
for a while.
By the way, when I run the python setup.py install command will
the script properly overwrite the existing version of the matplotlib
library, or should I go in and delete the old library first?
Thanks!
jgw
>>>>>> "John" == John Wohlbier <jd...@go...> writes:
>
> John> Hi, I am building a wxPython app, and would like to try
> John> incorporating matplotlib, even though the wx backend is
> John> reportedly in its development state. Could someone please
> John> give a snippet of code using the wx backend? Also, do I need
> John> pygtk even though I intend on using wxPython?
>
> The matplotlib code you write is more or less backend independent
> (same for gtk, wx, ps, etc..). You do not need pygtk. You just need
> wxpython and Numeric - which are both included in the enthought
> edition of python for win32, by the way; http://enthought.com/python.
>
> If you just want to make some figure windows to explore the plotting
> commands, you have 2 choices
>
> import matplotlib
> matplotlib.use('WX')
> from matplotlib.matlab import *
> plot([1,2,3])
> show()
>
> or
> # myscript.py
> from matplotlib.matlab import *
> plot([1,2,3])
> show()
>
> > python myscript.py -dWX
>
> That is, you choose the wx backend either by doing 'use' or -dWX. See
> http://matplotlib.sourceforge.net/backends.html for more info.
>
> See the examples dir of the src distro for examples of how to make plots
> more sophisticated than [1,2,3].
>
> But I gather from your post that you want to see an example of
> embedding the plot in an application. Jeremy, the wx backend
> implemented, can probably help you more here. In the mean time, you
> might want to look at the FigureManagerWX class in the file
> matplotlib/backends/backend_wx.py to see how to embed a plot in a wx
> frame.
>
> I recommend you use the latest CVS, which has a number of improvements
> over the 0.32 release. If you don't have CVS access, let me know and
> I'll send you a snapshot (are you on windows).
>
> John Hunter
|