Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Milestone
Description
I have seen a problem on more than one Mac running OS X 10.9.x where MPL images are not updated properly. As one example of this, when one zooms a plot, by selecting the zoom widget, the rectangle is never erased and after it is "released" the plot is never redrawn with the new limits. This happens when I embed a figure into a wx Panel, as shown in the script below.
I do not see the problem with EPD (python 2.7.3, wxpython 2.8.10.1, matplotlib 1.1.0), but do with fairly recent Anaconda (python 2.7.8, wxpython 3.0.0.0, matplotlib 1.4.2) and Canopy (python 2.7.6, wxpython 2.9.2.4, matplotlib 1.3.1) dists.
# simple demo that fails on Mac (at least on 10.9.5) and later wx/mpl combos## problem is that if one selects the zoom button and drags a region,# the rectangles never disappear and the image is not updated to# show the zoomed in region## works (not quite 100%) w/EPD (python 2.7.3, wxpython 2.8.10.1, matplotlib 1.1.0)# fails w/Anaconda (python 2.7.8, wxpython 3.0.0.0, matplotlib 1.4.2# fails w/Canopy (python 2.7.6, wxpython 2.9.2.4, matplotlib 1.3.1)#import sysimport wximport wx.auiimport matplotlib as mplfrom matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as mplCanvasfrom matplotlib.backends.backend_wxagg import NavigationToolbar2Wx as mplToolbarprint "python: ",sys.version[:5]print "wxpython: ",wx.__version__print "matplotlib: ",mpl.__version__app = wx.PySimpleApp()# create frame with notebookframe = wx.Frame(None, size=(400,400)) win = wx.Panel(frame)win.nb = wx.aui.AuiNotebook(win)sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(win.nb, 1, wx.EXPAND)win.SetSizer(sizer)# create a panel for the plot with a plot in ittab = wx.Panel(win.nb, id=-1)figure = mpl.figure.Figure(dpi=None)# create a quick figure for the plotax = figure.gca()ax.plot(range(10),range(10),'o-')canvas = mplCanvas(tab, -1, figure) toolbar = mplToolbar(canvas)toolbar.Realize()sizer = wx.BoxSizer(wx.VERTICAL)sizer.Add(canvas,1,wx.EXPAND)sizer.Add(toolbar, 0 , wx.LEFT | wx.EXPAND)tab.SetSizer(sizer)win.nb.AddPage(tab,'plot1') # add the panel as a notebook tabframe.Show()app.MainLoop()