From: <ef...@us...> - 2007-07-20 18:35:40
|
Revision: 3596 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3596&view=rev Author: efiring Date: 2007-07-20 11:35:35 -0700 (Fri, 20 Jul 2007) Log Message: ----------- examples/* updates from Stefan van der Walt Modified Paths: -------------- trunk/matplotlib/examples/animation_blit_wx.py trunk/matplotlib/examples/arrow_demo.py trunk/matplotlib/examples/dynamic_demo_wx.py trunk/matplotlib/examples/dynamic_image_wxagg2.py trunk/matplotlib/examples/embedding_in_wx.py trunk/matplotlib/examples/embedding_in_wx2.py trunk/matplotlib/examples/embedding_in_wx3.py trunk/matplotlib/examples/embedding_in_wx4.py trunk/matplotlib/examples/interactive.py trunk/matplotlib/examples/interactive2.py trunk/matplotlib/examples/mpl_with_glade.py trunk/matplotlib/examples/simple3d_oo.py trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/examples/animation_blit_wx.py =================================================================== --- trunk/matplotlib/examples/animation_blit_wx.py 2007-07-20 16:00:40 UTC (rev 3595) +++ trunk/matplotlib/examples/animation_blit_wx.py 2007-07-20 18:35:35 UTC (rev 3596) @@ -7,7 +7,7 @@ import matplotlib matplotlib.use('WXAgg') -matplotlib.rcParams['toolbar'] = None +matplotlib.rcParams['toolbar'] = 'None' import wx import sys Modified: trunk/matplotlib/examples/arrow_demo.py =================================================================== --- trunk/matplotlib/examples/arrow_demo.py 2007-07-20 16:00:40 UTC (rev 3595) +++ trunk/matplotlib/examples/arrow_demo.py 2007-07-20 18:35:35 UTC (rev 3596) @@ -205,7 +205,7 @@ M = array([[cx, sx],[-sx,cx]]) - coords = matrixmultiply(orig_position, M) + [[x_pos, y_pos]] + coords = dot(orig_position, M) + [[x_pos, y_pos]] x, y = ravel(coords) orig_label = rate_labels[pair] label = '$%s_{_{\mathrm{%s}}}$' % (orig_label[0], orig_label[1:]) Modified: trunk/matplotlib/examples/dynamic_demo_wx.py =================================================================== --- trunk/matplotlib/examples/dynamic_demo_wx.py 2007-07-20 16:00:40 UTC (rev 3595) +++ trunk/matplotlib/examples/dynamic_demo_wx.py 2007-07-20 18:35:35 UTC (rev 3596) @@ -64,15 +64,15 @@ from matplotlib.figure import Figure from matplotlib.axes import Subplot import matplotlib.numerix as numpy -from wxPython.wx import * +from wx import * -TIMER_ID = wxNewId() +TIMER_ID = NewId() -class PlotFigure(wxFrame): +class PlotFigure(Frame): def __init__(self): - wxFrame.__init__(self, None, -1, "Test embedded wxFigure") + Frame.__init__(self, None, -1, "Test embedded wxFigure") self.fig = Figure((5,4), 75) self.canvas = FigureCanvasWx(self, -1, self.fig) @@ -83,16 +83,16 @@ # you don't need this under Linux tw, th = self.toolbar.GetSizeTuple() fw, fh = self.canvas.GetSizeTuple() - self.toolbar.SetSize(wxSize(fw, th)) + self.toolbar.SetSize(Size(fw, th)) # Create a figure manager to manage things self.figmgr = FigureManager(self.canvas, 1, self) # Now put all into a sizer - sizer = wxBoxSizer(wxVERTICAL) + sizer = BoxSizer(VERTICAL) # This way of adding to sizer allows resizing - sizer.Add(self.canvas, 1, wxLEFT|wxTOP|wxGROW) + sizer.Add(self.canvas, 1, LEFT|TOP|GROW) # Best to allow the toolbar to resize! - sizer.Add(self.toolbar, 0, wxGROW) + sizer.Add(self.toolbar, 0, GROW) self.SetSizer(sizer) self.Fit() EVT_TIMER(self, TIMER_ID, self.onTimer) @@ -120,13 +120,13 @@ self.canvas.gui_repaint() if __name__ == '__main__': - app = wxPySimpleApp() + app = PySimpleApp() frame = PlotFigure() frame.init_plot_data() # Initialise the timer - wxPython requires this to be connected to the # receivicng event handler - t = wxTimer(frame, TIMER_ID) + t = Timer(frame, TIMER_ID) t.Start(100) frame.Show() Modified: trunk/matplotlib/examples/dynamic_image_wxagg2.py =================================================================== --- trunk/matplotlib/examples/dynamic_image_wxagg2.py 2007-07-20 16:00:40 UTC (rev 3595) +++ trunk/matplotlib/examples/dynamic_image_wxagg2.py 2007-07-20 18:35:35 UTC (rev 3596) @@ -18,9 +18,8 @@ # numerix=numarray, it is important to compile matplotlib for numarray # by setting NUMERIX = 'numarray' in setup.py before building from matplotlib import rcParams -rcParams['numerix'] = 'numarray' +import numpy as npy - # jdh: you can import cm directly, you don't need to go via # pylab import matplotlib.cm as cm @@ -32,16 +31,15 @@ # designed for the pylab interface from matplotlib.figure import Figure -import matplotlib.numerix as numerix -from wxPython.wx import * +from wx import * -TIMER_ID = wxNewId() +TIMER_ID = NewId() -class PlotFigure(wxFrame): +class PlotFigure(Frame): def __init__(self): - wxFrame.__init__(self, None, -1, "Test embedded wxFigure") + Frame.__init__(self, None, -1, "Test embedded wxFigure") self.fig = Figure((5,4), 75) self.canvas = FigureCanvasWxAgg(self, -1, self.fig) @@ -52,16 +50,16 @@ # you don't need this under Linux tw, th = self.toolbar.GetSizeTuple() fw, fh = self.canvas.GetSizeTuple() - self.toolbar.SetSize(wxSize(fw, th)) + self.toolbar.SetSize(Size(fw, th)) # Create a figure manager to manage things # Now put all into a sizer - sizer = wxBoxSizer(wxVERTICAL) + sizer = BoxSizer(VERTICAL) # This way of adding to sizer allows resizing - sizer.Add(self.canvas, 1, wxLEFT|wxTOP|wxGROW) + sizer.Add(self.canvas, 1, LEFT|TOP|GROW) # Best to allow the toolbar to resize! - sizer.Add(self.toolbar, 0, wxGROW) + sizer.Add(self.toolbar, 0, GROW) self.SetSizer(sizer) self.Fit() EVT_TIMER(self, TIMER_ID, self.onTimer) @@ -71,12 +69,12 @@ # the fig manager a = self.fig.add_axes([0.075,0.1,0.75,0.85]) cax = self.fig.add_axes([0.85,0.1,0.075,0.85]) - self.x = numerix.arange(120.0)*2*numerix.pi/120.0 - self.x.resize((100,120)) - self.y = numerix.arange(100.0)*2*numerix.pi/100.0 - self.y.resize((120,100)) - self.y = numerix.transpose(self.y) - z = numerix.sin(self.x) + numerix.cos(self.y) + self.x = npy.empty((120,120)) + self.x.flat = npy.arange(120.0)*2*npy.pi/120.0 + self.y = npy.empty((120,120)) + self.y.flat = npy.arange(120.0)*2*npy.pi/100.0 + self.y = npy.transpose(self.y) + z = npy.sin(self.x) + npy.cos(self.y) self.im = a.imshow( z, cmap=cm.jet)#, interpolation='nearest') self.fig.colorbar(self.im,cax=cax,orientation='vertical') @@ -86,9 +84,9 @@ return self.toolbar def onTimer(self, evt): - self.x += numerix.pi/15 - self.y += numerix.pi/20 - z = numerix.sin(self.x) + numerix.cos(self.y) + self.x += npy.pi/15 + self.y += npy.pi/20 + z = npy.sin(self.x) + npy.cos(self.y) self.im.set_array(z) self.canvas.draw() #self.canvas.gui_repaint() # jdh wxagg_draw calls this already @@ -98,13 +96,13 @@ pass if __name__ == '__main__': - app = wxPySimpleApp() + app = PySimpleApp() frame = PlotFigure() frame.init_plot_data() # Initialise the timer - wxPython requires this to be connected to # the receiving event handler - t = wxTimer(frame, TIMER_ID) + t = Timer(frame, TIMER_ID) t.Start(200) frame.Show() Modified: trunk/matplotlib/examples/embedding_in_wx.py =================================================================== --- trunk/matplotlib/examples/embedding_in_wx.py 2007-07-20 16:00:40 UTC (rev 3595) +++ trunk/matplotlib/examples/embedding_in_wx.py 2007-07-20 18:35:35 UTC (rev 3596) @@ -45,13 +45,13 @@ from matplotlib.figure import Figure from matplotlib.axes import Subplot import matplotlib.numerix as numpy -from wxPython.wx import * +from wx import * -class PlotFigure(wxFrame): +class PlotFigure(Frame): def __init__(self): - wxFrame.__init__(self, None, -1, "Test embedded wxFigure") + Frame.__init__(self, None, -1, "Test embedded wxFigure") self.fig = Figure((9,8), 75) self.canvas = FigureCanvasWx(self, -1, self.fig) @@ -62,16 +62,16 @@ # you don't need this under Linux tw, th = self.toolbar.GetSizeTuple() fw, fh = self.canvas.GetSizeTuple() - self.toolbar.SetSize(wxSize(fw, th)) + self.toolbar.SetSize(Size(fw, th)) # Create a figure manager to manage things self.figmgr = FigureManager(self.canvas, 1, self) # Now put all into a sizer - sizer = wxBoxSizer(wxVERTICAL) + sizer = BoxSizer(VERTICAL) # This way of adding to sizer allows resizing - sizer.Add(self.canvas, 1, wxLEFT|wxTOP|wxGROW) + sizer.Add(self.canvas, 1, LEFT|TOP|GROW) # Best to allow the toolbar to resize! - sizer.Add(self.toolbar, 0, wxGROW) + sizer.Add(self.toolbar, 0, GROW) self.SetSizer(sizer) self.Fit() @@ -95,7 +95,7 @@ return self.toolbar if __name__ == '__main__': - app = wxPySimpleApp(0) + app = PySimpleApp(0) frame = PlotFigure() frame.plot_data() frame.Show() Modified: trunk/matplotlib/examples/embedding_in_wx2.py =================================================================== --- trunk/matplotlib/examples/embedding_in_wx2.py 2007-07-20 16:00:40 UTC (rev 3595) +++ trunk/matplotlib/examples/embedding_in_wx2.py 2007-07-20 18:35:35 UTC (rev 3596) @@ -19,15 +19,15 @@ from matplotlib.figure import Figure -from wxPython.wx import * +from wx import * -class CanvasFrame(wxFrame): +class CanvasFrame(Frame): def __init__(self): - wxFrame.__init__(self,None,-1, + Frame.__init__(self,None,-1, 'CanvasFrame',size=(550,350)) - self.SetBackgroundColour(wxNamedColor("WHITE")) + self.SetBackgroundColour(NamedColor("WHITE")) self.figure = Figure() self.axes = self.figure.add_subplot(111) @@ -37,8 +37,8 @@ self.axes.plot(t,s) self.canvas = FigureCanvas(self, -1, self.figure) - self.sizer = wxBoxSizer(wxVERTICAL) - self.sizer.Add(self.canvas, 1, wxLEFT | wxTOP | wxGROW) + self.sizer = BoxSizer(VERTICAL) + self.sizer.Add(self.canvas, 1, LEFT | TOP | GROW) self.SetSizer(self.sizer) self.Fit() @@ -48,7 +48,7 @@ def add_toolbar(self): self.toolbar = NavigationToolbar2Wx(self.canvas) self.toolbar.Realize() - if wxPlatform == '__WXMAC__': + if Platform == '__WXMAC__': # Mac platform (OSX 10.3, MacPython) does not seem to cope with # having a toolbar in a sizer. This work-around gets the buttons # back, but at the expense of having the toolbar at the top @@ -61,8 +61,8 @@ # By adding toolbar in sizer, we are able to put it at the bottom # of the frame - so appearance is closer to GTK version. # As noted above, doesn't work for Mac. - self.toolbar.SetSize(wxSize(fw, th)) - self.sizer.Add(self.toolbar, 0, wxLEFT | wxEXPAND) + self.toolbar.SetSize(Size(fw, th)) + self.sizer.Add(self.toolbar, 0, LEFT | EXPAND) # update the axes menu on the toolbar self.toolbar.update() @@ -70,14 +70,14 @@ def OnPaint(self, event): self.canvas.draw() -class App(wxApp): +class App(App): def OnInit(self): 'Create the main window and insert the custom frame' frame = CanvasFrame() - frame.Show(true) + frame.Show(True) - return true + return True app = App(0) app.MainLoop() Modified: trunk/matplotlib/examples/embedding_in_wx3.py =================================================================== --- trunk/matplotlib/examples/embedding_in_wx3.py 2007-07-20 16:00:40 UTC (rev 3595) +++ trunk/matplotlib/examples/embedding_in_wx3.py 2007-07-20 18:35:35 UTC (rev 3596) @@ -21,27 +21,25 @@ import sys, time, os, gc import matplotlib matplotlib.use('WXAgg') -# some of this code is numarray dependent -matplotlib.rcParams['numerix'] = 'numarray' import matplotlib.cm as cm from matplotlib.backends.backend_wxagg import Toolbar, FigureCanvasWxAgg from matplotlib.figure import Figure -import matplotlib.numerix as numerix +import numpy as npy import matplotlib.numerix.mlab as mlab from matplotlib.mlab import meshgrid -from wxPython.wx import * -from wxPython.xrc import * +from wx import * +from wx.xrc import * ERR_TOL = 1e-5 # floating point slop for peak-detection matplotlib.rc('image', origin='lower') -class PlotPanel(wxPanel): +class PlotPanel(Panel): def __init__(self, parent): - wxPanel.__init__(self, parent, -1) + Panel.__init__(self, parent, -1) self.fig = Figure((5,4), 75) self.canvas = FigureCanvasWxAgg(self, -1, self.fig) @@ -50,27 +48,25 @@ #self.toolbar.set_active([0,1]) # Now put all into a sizer - sizer = wxBoxSizer(wxVERTICAL) + sizer = BoxSizer(VERTICAL) # This way of adding to sizer allows resizing - sizer.Add(self.canvas, 1, wxLEFT|wxTOP|wxGROW) + sizer.Add(self.canvas, 1, LEFT|TOP|GROW) # Best to allow the toolbar to resize! - sizer.Add(self.toolbar, 0, wxGROW) + sizer.Add(self.toolbar, 0, GROW) self.SetSizer(sizer) self.Fit() def init_plot_data(self): a = self.fig.add_subplot(111) - x = numerix.arange(120.0)*2*numerix.pi/60.0 - y = numerix.arange(100.0)*2*numerix.pi/50.0 + x = npy.arange(120.0)*2*npy.pi/60.0 + y = npy.arange(100.0)*2*npy.pi/50.0 self.x, self.y = meshgrid(x, y) - z = numerix.sin(self.x) + numerix.cos(self.y) + z = npy.sin(self.x) + npy.cos(self.y) self.im = a.imshow( z, cmap=cm.jet)#, interpolation='nearest') zmax = mlab.max(mlab.max(z))-ERR_TOL - - ymax_i, xmax_i = numerix.nonzero( - numerix.greater_equal(z, zmax)) + ymax_i, xmax_i = npy.nonzero(z >= zmax) if self.im.origin == 'upper': ymax_i = z.shape[0]-ymax_i self.lines = a.plot(xmax_i,ymax_i,'ko') @@ -83,14 +79,13 @@ return self.toolbar def OnWhiz(self,evt): - self.x += numerix.pi/15 - self.y += numerix.pi/20 - z = numerix.sin(self.x) + numerix.cos(self.y) + self.x += npy.pi/15 + self.y += npy.pi/20 + z = npy.sin(self.x) + npy.cos(self.y) self.im.set_array(z) zmax = mlab.max(mlab.max(z))-ERR_TOL - ymax_i, xmax_i = numerix.nonzero( - numerix.greater_equal(z, zmax)) + ymax_i, xmax_i = npy.nonzero(z >= zmax) if self.im.origin == 'upper': ymax_i = z.shape[0]-ymax_i self.lines[0].set_data(xmax_i,ymax_i) @@ -101,9 +96,9 @@ # this is supposed to prevent redraw flicker on some X servers... pass -class MyApp(wxApp): +class MyApp(App): def OnInit(self): - self.res = wxXmlResource("data/embedding_in_wx3.xrc") + self.res = XmlResource("data/embedding_in_wx3.xrc") # main frame and panel --------- @@ -115,14 +110,14 @@ # container for matplotlib panel (I like to make a container # panel for our panel so I know where it'll go when in XRCed.) plot_container = XRCCTRL(self.frame,"plot_container_panel") - sizer = wxBoxSizer(wxVERTICAL) + sizer = BoxSizer(VERTICAL) # matplotlib panel itself self.plotpanel = PlotPanel(plot_container) self.plotpanel.init_plot_data() # wx boilerplate - sizer.Add(self.plotpanel, 1, wxEXPAND) + sizer.Add(self.plotpanel, 1, EXPAND) plot_container.SetSizer(sizer) # whiz button ------------------ Modified: trunk/matplotlib/examples/embedding_in_wx4.py =================================================================== --- trunk/matplotlib/examples/embedding_in_wx4.py 2007-07-20 16:00:40 UTC (rev 3595) +++ trunk/matplotlib/examples/embedding_in_wx4.py 2007-07-20 18:35:35 UTC (rev 3596) @@ -21,13 +21,13 @@ from matplotlib.figure import Figure from matplotlib.numerix.mlab import rand -from wxPython.wx import * +from wx import * class MyNavigationToolbar(NavigationToolbar2WxAgg): """ Extend the default wx toolbar with your own event handlers """ - ON_CUSTOM = wxNewId() + ON_CUSTOM = NewId() def __init__(self, canvas, cankill): NavigationToolbar2WxAgg.__init__(self, canvas) @@ -56,13 +56,13 @@ evt.Skip() -class CanvasFrame(wxFrame): +class CanvasFrame(Frame): def __init__(self): - wxFrame.__init__(self,None,-1, + Frame.__init__(self,None,-1, 'CanvasFrame',size=(550,350)) - self.SetBackgroundColour(wxNamedColor("WHITE")) + self.SetBackgroundColour(NamedColor("WHITE")) self.figure = Figure(figsize=(5,4), dpi=100) self.axes = self.figure.add_subplot(111) @@ -73,14 +73,14 @@ self.canvas = FigureCanvas(self, -1, self.figure) - self.sizer = wxBoxSizer(wxVERTICAL) - self.sizer.Add(self.canvas, 1, wxTOP | wxLEFT | wxEXPAND) + self.sizer = BoxSizer(VERTICAL) + self.sizer.Add(self.canvas, 1, TOP | LEFT | EXPAND) # Capture the paint message EVT_PAINT(self, self.OnPaint) self.toolbar = MyNavigationToolbar(self.canvas, True) self.toolbar.Realize() - if wxPlatform == '__WXMAC__': + if Platform == '__WXMAC__': # Mac platform (OSX 10.3, MacPython) does not seem to cope with # having a toolbar in a sizer. This work-around gets the buttons # back, but at the expense of having the toolbar at the top @@ -93,8 +93,8 @@ # By adding toolbar in sizer, we are able to put it at the bottom # of the frame - so appearance is closer to GTK version. # As noted above, doesn't work for Mac. - self.toolbar.SetSize(wxSize(fw, th)) - self.sizer.Add(self.toolbar, 0, wxLEFT | wxEXPAND) + self.toolbar.SetSize(Size(fw, th)) + self.sizer.Add(self.toolbar, 0, LEFT | EXPAND) # update the axes menu on the toolbar self.toolbar.update() @@ -106,14 +106,14 @@ self.canvas.draw() event.Skip() -class App(wxApp): +class App(App): def OnInit(self): 'Create the main window and insert the custom frame' frame = CanvasFrame() - frame.Show(true) + frame.Show(True) - return true + return True app = App(0) app.MainLoop() Modified: trunk/matplotlib/examples/interactive.py =================================================================== --- trunk/matplotlib/examples/interactive.py 2007-07-20 16:00:40 UTC (rev 3595) +++ trunk/matplotlib/examples/interactive.py 2007-07-20 18:35:35 UTC (rev 3596) @@ -162,7 +162,7 @@ gobject.timeout_add(self.TIMEOUT, self.shell.runcode) try: if gtk.gtk_version[0] >= 2: - gtk.threads_init() + gtk.gdk.threads_init() except AttributeError: pass gtk.main() Modified: trunk/matplotlib/examples/interactive2.py =================================================================== --- trunk/matplotlib/examples/interactive2.py 2007-07-20 16:00:40 UTC (rev 3595) +++ trunk/matplotlib/examples/interactive2.py 2007-07-20 18:35:35 UTC (rev 3596) @@ -116,7 +116,7 @@ def __init__(self,view,old_out,style): self.view = view self.buffer = view.get_buffer() - self.mark = self.buffer.create_mark("End",self.buffer.get_end_iter(), gtk.FALSE ) + self.mark = self.buffer.create_mark("End",self.buffer.get_end_iter(), False ) self.out = old_out self.style = style self.tee = 1 @@ -128,7 +128,7 @@ end = self.buffer.get_end_iter() if not self.view == None: - self.view.scroll_to_mark(self.mark, 0, gtk.TRUE, 1, 1) + self.view.scroll_to_mark(self.mark, 0, True, 1, 1) self.buffer.insert_with_tags(end,text,self.style) @@ -142,7 +142,7 @@ self.set_policy (gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC) self.text = gtk.TextView() - self.text.set_wrap_mode(gtk.TRUE) + self.text.set_wrap_mode(True) self.interpreter = code.InteractiveInterpreter() @@ -158,7 +158,7 @@ self.current_history = -1 - self.mark = self.text.get_buffer().create_mark("End",self.text.get_buffer().get_end_iter(), gtk.FALSE ) + self.mark = self.text.get_buffer().create_mark("End",self.text.get_buffer().get_end_iter(), False ) #setup colors self.style_banner = gtk.TextTag("banner") @@ -166,12 +166,12 @@ self.style_ps1 = gtk.TextTag("ps1") self.style_ps1.set_property( "foreground", "DarkOrchid4" ) - self.style_ps1.set_property( "editable", gtk.FALSE ) + self.style_ps1.set_property( "editable", False ) self.style_ps1.set_property("font", "courier" ) self.style_ps2 = gtk.TextTag("ps2") self.style_ps2.set_property( "foreground", "DarkOliveGreen" ) - self.style_ps2.set_property( "editable", gtk.FALSE ) + self.style_ps2.set_property( "editable", False ) self.style_ps2.set_property("font", "courier" ) self.style_out = gtk.TextTag("stdout") @@ -222,7 +222,7 @@ else: self.text.get_buffer().insert_with_tags(end,text,style) - self.text.scroll_to_mark(self.mark, 0, gtk.TRUE, 1, 1) + self.text.scroll_to_mark(self.mark, 0, True, 1, 1) def push(self, line): @@ -257,21 +257,21 @@ l = self.text.get_buffer().get_line_count() - 1 start = self.text.get_buffer().get_iter_at_line_offset(l,4) self.text.get_buffer().place_cursor(start) - return gtk.TRUE + return True elif event.keyval == gtk.gdk.keyval_from_name( 'space') and event.state & gtk.gdk.CONTROL_MASK: return self.complete_line() - return gtk.FALSE + return False def show_history(self): if self.current_history == 0: - return gtk.TRUE + return True else: self.replace_line( self.history[self.current_history] ) - return gtk.TRUE + return True def current_line(self): start,end = self.current_line_bounds() - return self.text.get_buffer().get_text(start,end, gtk.TRUE) + return self.text.get_buffer().get_text(start,end, True) def current_line_bounds(self): txt_buffer = self.text.get_buffer() @@ -310,7 +310,7 @@ self.window.raise_() - return gtk.TRUE + return True def complete_line(self): line = self.current_line() @@ -334,7 +334,7 @@ line = line[0:i] + completions[0] self.replace_line(line) - return gtk.TRUE + return True def main(): @@ -350,7 +350,7 @@ if gtk.gdk.keyval_name( event.keyval) == 'd' and \ event.state & gtk.gdk.CONTROL_MASK: destroy() - return gtk.FALSE + return False w.connect("destroy", destroy) Modified: trunk/matplotlib/examples/mpl_with_glade.py =================================================================== --- trunk/matplotlib/examples/mpl_with_glade.py 2007-07-20 16:00:40 UTC (rev 3595) +++ trunk/matplotlib/examples/mpl_with_glade.py 2007-07-20 18:35:35 UTC (rev 3596) @@ -6,7 +6,7 @@ from matplotlib.axes import Subplot from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar -from matplotlib.widgets import HorizontalSpanSelector +from matplotlib.widgets import SpanSelector from matplotlib.numerix import arange, sin, pi import gtk @@ -74,8 +74,8 @@ def onselect(xmin, xmax): print xmin, xmax - span = HorizontalSpanSelector(self.axis, onselect, useblit=False, - rectprops=dict(alpha=0.5, facecolor='red') ) + span = SpanSelector(self.axis, onselect, 'horizontal', useblit=False, + rectprops=dict(alpha=0.5, facecolor='red') ) self['vboxMain'].pack_start(self.canvas, True, True) Modified: trunk/matplotlib/examples/simple3d_oo.py =================================================================== --- trunk/matplotlib/examples/simple3d_oo.py 2007-07-20 16:00:40 UTC (rev 3595) +++ trunk/matplotlib/examples/simple3d_oo.py 2007-07-20 18:35:35 UTC (rev 3596) @@ -4,16 +4,16 @@ matplotlib.use('WXAgg') matplotlib.rcParams['numerix'] = 'numpy' -from wxPython.wx import * +from wx import * import matplotlib.axes3d import matplotlib.mlab from matplotlib import numerix as nx from matplotlib.figure import Figure from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg, FigureManager, NavigationToolbar2WxAgg -class PlotFigure(wxFrame): +class PlotFigure(Frame): def __init__(self): - wxFrame.__init__(self, None, -1, "Test embedded wxFigure") + Frame.__init__(self, None, -1, "Test embedded wxFigure") self.fig = Figure((9,8), 75) self.canvas = FigureCanvasWxAgg(self, -1, self.fig) @@ -23,12 +23,12 @@ self.figmgr = FigureManager(self.canvas, 1, self) tw, th = self.toolbar.GetSizeTuple() fw, fh = self.canvas.GetSizeTuple() - self.toolbar.SetSize(wxSize(fw, th)) - sizer = wxBoxSizer(wxVERTICAL) + self.toolbar.SetSize(Size(fw, th)) + sizer = BoxSizer(VERTICAL) # This way of adding to sizer allows resizing - sizer.Add(self.canvas, 1, wxLEFT|wxTOP|wxGROW) - sizer.Add(self.toolbar, 0, wxGROW) + sizer.Add(self.canvas, 1, LEFT|TOP|GROW) + sizer.Add(self.toolbar, 0, GROW) self.SetSizer(sizer) self.Fit() @@ -58,7 +58,7 @@ self.fig.savefig('globe') if __name__ == '__main__': - app = wxPySimpleApp(0) + app = PySimpleApp(0) frame = PlotFigure() frame.Show() app.MainLoop() Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2007-07-20 16:00:40 UTC (rev 3595) +++ trunk/matplotlib/lib/matplotlib/axes.py 2007-07-20 18:35:35 UTC (rev 3596) @@ -2364,7 +2364,7 @@ if len(xmin)==1: xmin = xmin*ones(y.shape, y.dtype) - if len(ymax)==1: + if len(xmax)==1: xmax = xmax*ones(y.shape, y.dtype) xmin = npy.asarray(xmin) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |