|
From: <jd...@us...> - 2008-07-28 15:40:26
|
Revision: 5909
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5909&view=rev
Author: jdh2358
Date: 2008-07-28 15:40:22 +0000 (Mon, 28 Jul 2008)
Log Message:
-----------
restored axes frame, made patch edge invisible
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Added Paths:
-----------
trunk/matplotlib/examples/user_interfaces/embedding_in_wx5.py
Added: trunk/matplotlib/examples/user_interfaces/embedding_in_wx5.py
===================================================================
--- trunk/matplotlib/examples/user_interfaces/embedding_in_wx5.py (rev 0)
+++ trunk/matplotlib/examples/user_interfaces/embedding_in_wx5.py 2008-07-28 15:40:22 UTC (rev 5909)
@@ -0,0 +1,48 @@
+import wx
+import wx.aui
+import matplotlib as mpl
+from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas
+from matplotlib.backends.backend_wxagg import NavigationToolbar2Wx as Toolbar
+
+class Plot(wx.Panel):
+ def __init__(self, parent, id = -1, dpi = None, **kwargs):
+ wx.Panel.__init__(self, parent, id=id, **kwargs)
+ self.figure = mpl.figure.Figure(dpi=dpi, figsize=(2,2))
+ self.canvas = Canvas(self, -1, self.figure)
+ self.toolbar = Toolbar(self.canvas)
+ self.toolbar.Realize()
+
+ sizer = wx.BoxSizer(wx.VERTICAL)
+ sizer.Add(self.canvas,1,wx.EXPAND)
+ sizer.Add(self.toolbar, 0 , wx.LEFT | wx.EXPAND)
+ self.SetSizer(sizer)
+
+class PlotNotebook(wx.Panel):
+ def __init__(self, parent, id = -1):
+ wx.Panel.__init__(self, parent, id=id)
+ self.nb = wx.aui.AuiNotebook(self)
+ sizer = wx.BoxSizer()
+ sizer.Add(self.nb, 1, wx.EXPAND)
+ self.SetSizer(sizer)
+
+ def add(self,name="plot"):
+ page = Plot(self.nb)
+ self.nb.AddPage(page,name)
+ return page.figure
+
+
+def demo():
+ app = wx.PySimpleApp()
+ frame = wx.Frame(None,-1,'Plotter')
+ plotter = PlotNotebook(frame)
+ axes1 = plotter.add('figure 1').gca()
+ axes1.plot([1,2,3],[2,1,4])
+ axes2 = plotter.add('figure 2').gca()
+ axes2.plot([1,2,3,4,5],[2,1,4,2,3])
+ #axes1.figure.canvas.draw()
+ #axes2.figure.canvas.draw()
+ frame.Show()
+ app.MainLoop()
+
+if __name__ == "__main__": demo()
+
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-07-28 14:12:09 UTC (rev 5908)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-07-28 15:40:22 UTC (rev 5909)
@@ -845,12 +845,14 @@
self._set_artist_props(self.title)
# the patch draws the background of the axes. we want this to
- # be below the other artists; the axesPatch name is deprecated
+ # be below the other artists; the axesPatch name is
+ # deprecated. We use the frame to draw the edges so we are
+ # setting the edgecolor to None
self.patch = self.axesPatch = self._gen_axes_patch()
self.patch.set_figure(self.figure)
self.patch.set_facecolor(self._axisbg)
- self.patch.set_edgecolor(rcParams['axes.edgecolor'])
- self.patch.set_linewidth(rcParams['axes.linewidth'])
+ self.patch.set_edgecolor('None')
+ self.patch.set_linewidth(0)
self.patch.set_transform(self.transAxes)
# the frame draws the border around the axes and we want this
@@ -1504,6 +1506,10 @@
if self.legend_ is not None:
artists.append(self.legend_)
+ if self.axison and self._frameon:
+ artists.append(self.frame)
+
+
dsu = [ (a.zorder, i, a) for i, a in enumerate(artists)
if not a.get_animated() ]
dsu.sort()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|