I have a problem that probably highlights a problem with how I
normally use mpl vs. how I should use it. I have some utility scripts
that do various data processing tasks and also have convenience
functions for plotting data using pylab. Almost all of my scripts
have a line like this near the top:
from pylab import figure, cla, clf, plot, subplot, show, ylabel,
xlabel, xlim, ylim, semilogx, legend, title, savefig
I am now trying to import some of my data processing functions into a
script that is embedding matplotib in a wxPython application following
the embedding_in_wx#.py examples. I am getting this error:
ryan@...1519...:~/siue/Research/PythonSimulationEnvironment$ python SystemID_gui.py
Traceback (most recent call last):
File "SystemID_gui.py", line 18, in ?
import rwkbode
File "/home/ryan/pythonutil/rwkbode/__init__.py", line 3, in ?
import pylab
File "/usr/lib/python2.4/site-packages/pylab.py", line 1, in ?
from matplotlib.pylab import *
File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line 216, in ?
from backends import new_figure_manager, draw_if_interactive, show
ImportError: cannot import name new_figure_manager
which seems to say that pylab cannot be imported after my wx mpl panel
has done this:
import matplotlib
import wx
from scipy import sin, cos, pi, atleast_1d, shape, log10
#from wxPython.wx import *
matplotlib.use('WXAgg')
import matplotlib.cm as cm
from matplotlib.backends.backend_wxagg import Toolbar, FigureCanvasWxAgg
from matplotlib.figure import Figure
import matplotlib.numerix as numerix
import matplotlib.numerix.mlab as mlab
from matplotlib.mlab import meshgrid
How should I be using matplotlib/pylab in my utility scripts so that
they are compatible with embedding in wx?
Thanks,
Ryan