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.



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

--
Brian Blais
[EMAIL PROTECTED]
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(2*numpy.pi*t)
        a.plot(t,s)

if __name__ == '__main__':
    app = PySimpleApp(0)
    frame = PlotFigure()
    frame.plot_data()
    frame.Show()
    app.MainLoop()

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to