I am posting here the minimal program that reproduces the problem, based on a modified embedded_in_wx.py. The axis shows up, and has the right limits, but no plot forms in the axis. Weird!
bb
···
On Apr 23, 2008, at Apr 23:4:33 PM, Brian Blais wrote:
I just upgraded a number of things on my Mac OS X (Tiger) machine, including to the latest version of wx and matplotlib. I found that there is a bug in the display of dynamic plots with subplots. If I change the subplot line in the examples/dynamic_demo_wx.py to:
a = self.fig.add_subplot(221)
instead of
a = self.fig.add_subplot(111)
the plot never shows. It works for 111, and for 121, but not 221. Not sure why! It works in interactive mode, in ipython, but not in dynamic plot.
–
Brian Blais
bblais@…1129…
http://web.bryant.edu/~bblais
#!/usr/bin/env python
from matplotlib.backends.backend_wx import FigureCanvasWx,FigureManager
from matplotlib.figure import Figure
import numpy
from wx import *
class PlotFigure(Frame):
def init(self):
Frame.init(self, None, -1, “Test embedded wxFigure”)
self.fig = Figure((9,8), 75)
self.canvas = FigureCanvasWx(self, -1, self.fig)
Create a figure manager to manage things
self.figmgr = FigureManager(self.canvas, 1, self)
Now put all into a sizer
sizer = BoxSizer(VERTICAL)
This way of adding to sizer allows resizing
sizer.Add(self.canvas, 1, LEFT|TOP|GROW)
self.SetSizer(sizer)
self.Fit()
def plot_data(self):
a = self.fig.add_subplot(111) # this works
a = self.fig.add_subplot(221) # this doesn’t work
t = numpy.arange(0.0,3.0,0.01)
s = numpy.sin(2numpy.pit)
a.plot(t,s)
if name == ‘main’:
app = PySimpleApp(0)
frame = PlotFigure()
frame.plot_data()
frame.Show()
app.MainLoop()