You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
1
(3) |
2
(2) |
3
(5) |
4
(1) |
5
|
6
|
7
(6) |
8
(3) |
9
(7) |
10
(6) |
11
(14) |
12
(6) |
13
(10) |
14
(6) |
15
|
16
|
17
(15) |
18
(6) |
19
(1) |
20
(4) |
21
(8) |
22
(9) |
23
(12) |
24
(35) |
25
(21) |
26
(14) |
27
(11) |
28
(9) |
29
(11) |
30
(6) |
31
(9) |
|
|
Revision: 5916 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5916&view=rev Author: mmetz_bn Date: 2008年07月29日 10:53:45 +0000 (2008年7月29日) Log Message: ----------- Minor hist-doc updates Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年07月28日 19:59:19 UTC (rev 5915) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年07月29日 10:53:45 UTC (rev 5916) @@ -6127,10 +6127,12 @@ is an integer input argument=numbins, *bins* + 1 bin edges will be returned, compatible with the semantics of :func:`numpy.histogram` with the *new* = True argument. + Unequally spaced bins are supported if *bins* is a sequence. *range*: The lower and upper range of the bins. Lower and upper outliers are ignored. If not provided, *range* is (x.min(), x.max()). + Range has no effect if *bins* is a sequence. *normed*: If *True*, the first element of the return tuple will @@ -6147,7 +6149,7 @@ gives the counts in that bin plus all bins for smaller values. The last bin gives the total number of datapoints. If *normed* is also *True* then the histogram is normalized such that the - last bin equals one. If *cumulative* evaluates to less that 1 + last bin equals one. If *cumulative* evaluates to less than 0 (e.g. -1), the direction of accumulation is reversed. In this case, if *normed* is also *True*, then the histogram is normalized such that the first bin equals 1. @@ -6167,8 +6169,7 @@ filled. *align*: ['left' | 'mid' | 'right' ] - Controls how the histogram is - plotted. + Controls how the histogram is plotted. - 'left': bars are centered on the left bin edges @@ -6178,7 +6179,8 @@ *orientation*: [ 'horizontal' | 'vertical' ] If 'horizontal', :func:`~matplotlib.pyplot.barh` will be - used and the *bottom* kwarg will be the left edges. + used for bar-type histograms and the *bottom* kwarg will be + the left edges. *rwidth*: the relative width of the bars as a fraction of the bin This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5915 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5915&view=rev Author: jdh2358 Date: 2008年07月28日 19:59:19 +0000 (2008年7月28日) Log Message: ----------- commented out seterr in npy -- ma looks broken here Modified Paths: -------------- trunk/matplotlib/examples/pylab_examples/geo_demo.py trunk/matplotlib/unit/memleak_hawaii3.py Modified: trunk/matplotlib/examples/pylab_examples/geo_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/geo_demo.py 2008年07月28日 17:29:57 UTC (rev 5914) +++ trunk/matplotlib/examples/pylab_examples/geo_demo.py 2008年07月28日 19:59:19 UTC (rev 5915) @@ -1,5 +1,5 @@ import numpy as np -np.seterr("raise") +#np.seterr("raise") from pylab import * Modified: trunk/matplotlib/unit/memleak_hawaii3.py =================================================================== --- trunk/matplotlib/unit/memleak_hawaii3.py 2008年07月28日 17:29:57 UTC (rev 5914) +++ trunk/matplotlib/unit/memleak_hawaii3.py 2008年07月28日 19:59:19 UTC (rev 5915) @@ -2,7 +2,7 @@ import os, sys, time, gc import matplotlib -matplotlib.use('Agg') +matplotlib.use('PDF') from matplotlib.cbook import report_memory import numpy as np This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5914 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5914&view=rev Author: jswhit Date: 2008年07月28日 17:29:57 +0000 (2008年7月28日) Log Message: ----------- don't touch axesPatch or frame default zorder. Modified Paths: -------------- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008年07月28日 16:58:16 UTC (rev 5913) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008年07月28日 17:29:57 UTC (rev 5914) @@ -1214,22 +1214,19 @@ # use axesPatch for fill_color, frame for border line props. ax.frame.set_linewidth(linewidth) if self.projection not in ['geos','ortho']: - if fill_color is None: - ax.axesPatch.set_facecolor(ax.get_axis_bgcolor()) - else: + if fill_color is not None: ax.axesPatch.set_facecolor(fill_color) - ax.axesPatch.set_zorder(0) - ax.frame.set_zorder(0) ax.frame.set_edgecolor(color) ax.set_frame_on(True) + # FIXME? should zorder be set separately for edge and background? if zorder is not None: ax.axesPatch.set_zorder(zorder) ax.frame.set_zorder(zorder) else: # use axesPatch for fill_color, frame for border line props. - ax.axesPatch.set_edgecolor(color) ax.frame.set_edgecolor(color) ax.set_frame_on(True) + # FIXME? should zorder be set separately for edge and background? if zorder is not None: ax.axesPatch.set_zorder(zorder) ax.frame.set_zorder(zorder) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5913 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5913&view=rev Author: jswhit Date: 2008年07月28日 16:58:16 +0000 (2008年7月28日) Log Message: ----------- make sure griddata issues verbose report only the first time it is called. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/mlab.py Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2008年07月28日 16:42:10 UTC (rev 5912) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2008年07月28日 16:58:16 UTC (rev 5913) @@ -2603,10 +2603,12 @@ import matplotlib.delaunay as delaunay from matplotlib.delaunay import __version__ _use_natgrid = False - if _use_natgrid: - verbose.report('using natgrid version %s' % __version__) - else: - verbose.report('using delaunay version %s' % __version__) + if not griddata._reported: + if _use_natgrid: + verbose.report('using natgrid version %s' % __version__) + else: + verbose.report('using delaunay version %s' % __version__) + griddata._reported = True if xi.ndim != yi.ndim: raise TypeError("inputs xi and yi must have same number of dimensions (1 or 2)") if xi.ndim != 1 and xi.ndim != 2: @@ -2645,3 +2647,4 @@ if np.any(np.isnan(zo)): zo = np.ma.masked_where(np.isnan(zo),zo) return zo +griddata._reported = False This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5912 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5912&view=rev Author: jdh2358 Date: 2008年07月28日 16:42:10 +0000 (2008年7月28日) Log Message: ----------- added some additional comments to axes to clarify the patch/frame relationship Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年07月28日 16:37:00 UTC (rev 5911) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年07月28日 16:42:10 UTC (rev 5912) @@ -1451,6 +1451,8 @@ self.apply_aspect(self.get_position(True)) + # the patch draws the background rectangle -- the frame below + # will draw the edges if self.axison and self._frameon: self.patch.draw(renderer) @@ -1506,6 +1508,9 @@ if self.legend_ is not None: artists.append(self.legend_) + # the frame draws the edges around the axes patch -- we + # decouple these so the patch can be in the background and the + # frame in the foreground. if self.axison and self._frameon: artists.append(self.frame) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5911 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5911&view=rev Author: jdh2358 Date: 2008年07月28日 16:37:00 +0000 (2008年7月28日) Log Message: ----------- fixed symlog locator transform bug sf id 2029141 Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/ticker.py Modified: trunk/matplotlib/lib/matplotlib/ticker.py =================================================================== --- trunk/matplotlib/lib/matplotlib/ticker.py 2008年07月28日 16:23:26 UTC (rev 5910) +++ trunk/matplotlib/lib/matplotlib/ticker.py 2008年07月28日 16:37:00 UTC (rev 5911) @@ -1077,7 +1077,8 @@ b = self._transform.base vmin, vmax = self.axis.get_view_interval() - vmin, vmax = self._transform.transform_point((vmin, vmax)) + vmin, vmax = self._transform.transform((vmin, vmax)) + if vmax<vmin: vmin, vmax = vmax, vmin numdec = math.floor(vmax)-math.ceil(vmin) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5910 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5910&view=rev Author: jswhit Date: 2008年07月28日 16:23:26 +0000 (2008年7月28日) Log Message: ----------- make sure axes.frame (not axes.AxesPatch) used to define properties of map boundary line. Modified Paths: -------------- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008年07月28日 15:40:22 UTC (rev 5909) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008年07月28日 16:23:26 UTC (rev 5910) @@ -1211,23 +1211,28 @@ if zorder is not None: limb.set_zorder(zorder) else: # all other projections are rectangular. - ax.axesPatch.set_linewidth(linewidth) + # use axesPatch for fill_color, frame for border line props. + ax.frame.set_linewidth(linewidth) if self.projection not in ['geos','ortho']: if fill_color is None: ax.axesPatch.set_facecolor(ax.get_axis_bgcolor()) else: ax.axesPatch.set_facecolor(fill_color) ax.axesPatch.set_zorder(0) - ax.axesPatch.set_edgecolor(color) + ax.frame.set_zorder(0) + ax.frame.set_edgecolor(color) ax.set_frame_on(True) if zorder is not None: ax.axesPatch.set_zorder(zorder) + ax.frame.set_zorder(zorder) else: - ax.axesPatch.set_facecolor(ax.get_axis_bgcolor()) + # use axesPatch for fill_color, frame for border line props. ax.axesPatch.set_edgecolor(color) + ax.frame.set_edgecolor(color) ax.set_frame_on(True) if zorder is not None: ax.axesPatch.set_zorder(zorder) + ax.frame.set_zorder(zorder) # for geos or ortho projections, also # draw and fill map projection limb, clipped # to rectangular region. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5909 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5909&view=rev Author: jdh2358 Date: 2008年07月28日 15:40:22 +0000 (2008年7月28日) 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.
Revision: 5908 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5908&view=rev Author: jswhit Date: 2008年07月28日 14:12:09 +0000 (2008年7月28日) Log Message: ----------- mpl_toolkits._natgrid now exists Modified Paths: -------------- trunk/matplotlib/CHANGELOG Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年07月28日 07:26:47 UTC (rev 5907) +++ trunk/matplotlib/CHANGELOG 2008年07月28日 14:12:09 UTC (rev 5908) @@ -17,7 +17,7 @@ 2008年07月21日 Added scikits.delaunay as matplotlib.delaunay. Added griddata function in matplotlib.mlab, with example (griddata_demo.py) in pylab_examples. griddata function will use mpl_toolkits._natgrid - if installed (haven't yet created the toolkit). - JSW + if installed. - JSW 2008年07月21日 Re-introduced offset_copy that works in the context of the new transforms. - MGD This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5907 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5907&view=rev Author: pkienzle Date: 2008年07月28日 07:26:47 +0000 (2008年7月28日) Log Message: ----------- Render Wx backends only when necessary Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py trunk/matplotlib/lib/matplotlib/backends/backend_wxagg.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008年07月27日 20:42:13 UTC (rev 5906) +++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008年07月28日 07:26:47 UTC (rev 5907) @@ -700,12 +700,11 @@ self.bitmap =wx.EmptyBitmap(w, h) DEBUG_MSG("__init__() - bitmap w:%d h:%d" % (w,h), 2, self) # TODO: Add support for 'point' inspection and plot navigation. - self._isRealized = False - self._isConfigured = False - self._printQued = [] + self._isDrawn = False bind(self, wx.EVT_SIZE, self._onSize) bind(self, wx.EVT_PAINT, self._onPaint) + bind(self, wx.EVT_ERASE_BACKGROUND, self._onEraseBackground) bind(self, wx.EVT_KEY_DOWN, self._onKeyDown) bind(self, wx.EVT_KEY_UP, self._onKeyUp) bind(self, wx.EVT_RIGHT_DOWN, self._onRightButtonDown) @@ -718,21 +717,12 @@ bind(self, wx.EVT_MOTION, self._onMotion) bind(self, wx.EVT_LEAVE_WINDOW, self._onLeave) bind(self, wx.EVT_IDLE, self._onIdle) + self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) self.macros = {} # dict from wx id to seq of macros self.Printer_Init() - # Create an timer for handling draw_idle requests - # If there are events pending when the timer is - # complete, reset the timer and continue. The - # alternative approach, binding to wx.EVT_IDLE, - # doesn't behave as nicely. - #self.idletimer = wx.CallLater(1,self._onDrawIdle) - self.idletimer = wx.FutureCall(1,self._onDrawIdle) - # FutureCall is a backwards-compatible alias; - # CallLater became available in 2.7.1.1. - def Destroy(self, *args, **kwargs): wx.Panel.Destroy(self, *args, **kwargs) @@ -887,20 +877,35 @@ self.gui_repaint() - def draw_idle(self, *args, **kwargs): + def draw_idle(self): """ Delay rendering until the GUI is idle. """ DEBUG_MSG("draw_idle()", 1, self) - self.idletimer.Restart(50, *args, **kwargs) # Delay by 50 ms + self._isDrawn = False # Force redraw + # Create a timer for handling draw_idle requests + # If there are events pending when the timer is + # complete, reset the timer and continue. The + # alternative approach, binding to wx.EVT_IDLE, + # doesn't behave as nicely. + if hasattr(self,'_idletimer'): + self._idletimer.Restart(50) + else: + self._idletimer = wx.FutureCall(50,self._onDrawIdle) + # FutureCall is a backwards-compatible alias; + # CallLater became available in 2.7.1.1. def _onDrawIdle(self, *args, **kwargs): - if False and wx.GetApp().Pending(): - self.idletimer.Restart(5, *args, **kwargs) + if wx.GetApp().Pending(): + self._idletimer.Restart(50, *args, **kwargs) else: - self.draw(*args, **kwargs) + del self._idletimer + # GUI event or explicit draw call may already + # have caused the draw to take place + if not self._isDrawn: + self.draw(*args, **kwargs) - def draw(self, repaint=True): + def draw(self, drawDC=None): """ Render the figure using RendererWx instance renderer, or using a previously defined renderer if none is specified. @@ -908,8 +913,8 @@ DEBUG_MSG("draw()", 1, self) self.renderer = RendererWx(self.bitmap, self.figure.dpi) self.figure.draw(self.renderer) - if repaint: - self.gui_repaint() + self._isDrawn = True + self.gui_repaint(drawDC=drawDC) def flush_events(self): wx.Yield() @@ -988,7 +993,6 @@ """ DEBUG_MSG("gui_repaint()", 1, self) if self.IsShownOnScreen(): - if drawDC is None: drawDC=wx.ClientDC(self) @@ -996,6 +1000,8 @@ drawDC.DrawBitmap(self.bitmap, 0, 0) drawDC.EndDrawing() #wx.GetApp().Yield() + else: + pass filetypes = FigureCanvasBase.filetypes.copy() filetypes['bmp'] = 'Windows bitmap' @@ -1007,6 +1013,16 @@ filetypes['tiff'] = 'Tagged Image Format File' filetypes['xpm'] = 'X pixmap' + def print_figure(self, filename, *args, **kwargs): + # Use pure Agg renderer to draw + FigureCanvasBase.print_figure(self, filename, *args, **kwargs) + # Restore the current view; this is needed because the + # artist contains methods rely on particular attributes + # of the rendered figure for determining things like + # bounding boxes. + if self._isDrawn: + self.draw() + def print_bmp(self, filename, *args, **kwargs): return self._print_image(filename, wx.BITMAP_TYPE_BMP, *args, **kwargs) @@ -1034,8 +1050,6 @@ width = int(math.ceil(width)) height = int(math.ceil(height)) - # Following performs the same function as realize(), but without - # setting GUI attributes - so GUI draw() will render correctly self.bitmap = wx.EmptyBitmap(width, height) renderer = RendererWx(self.bitmap, self.figure.dpi) @@ -1048,9 +1062,6 @@ if is_string_like(filename): if not self.bitmap.SaveFile(filename, filetype): DEBUG_MSG('print_figure() file save error', 4, self) - # note the error must be displayed here because trapping - # the error on a call or print_figure may not work because - # printing can be qued and called from realize raise RuntimeError('Could not save figure to %s\n' % (filename)) elif is_writable_file_like(filename): if not self.bitmap.ConvertToImage().SaveStream(filename, filetype): @@ -1063,40 +1074,35 @@ # Note: draw is required here since bits of state about the # last renderer are strewn about the artist draw methods. Do # not remove the draw without first verifying that these have - # been cleaned up. - self.draw() + # been cleaned up. The artist contains() methods will fail + # otherwise. + if self._isDrawn: + self.draw() self.Refresh() def get_default_filetype(self): return 'png' - def realize(self): - """ - This method will be called when the system is ready to draw, - eg when a GUI window is realized - """ - DEBUG_MSG("realize()", 1, self) - self._isRealized = True - for fname, dpi, facecolor, edgecolor in self._printQued: - self.print_figure(fname, dpi, facecolor, edgecolor) - self._printQued = [] - - - def _onPaint(self, evt): """ Called when wxPaintEvt is generated """ DEBUG_MSG("_onPaint()", 1, self) - if not self._isRealized: - self.realize() - # Render to the bitmap - self.draw(repaint=False) - # Update the display using a PaintDC - self.gui_repaint(drawDC=wx.PaintDC(self)) + drawDC = wx.PaintDC(self) + if not self._isDrawn: + self.draw(drawDC=drawDC) + else: + self.gui_repaint(drawDC=drawDC) evt.Skip() + def _onEraseBackground(self, evt): + """ + Called when window is redrawn; since we are blitting the entire + image, we can leave this blank to suppress flicker. + """ + pass + def _onSize(self, evt): """ Called when wxEventSize is generated. @@ -1109,21 +1115,19 @@ # Create a new, correctly sized bitmap self._width, self._height = self.GetClientSize() self.bitmap =wx.EmptyBitmap(self._width, self._height) + self._isDrawn = False if self._width <= 1 or self._height <= 1: return # Empty figure - # Scale the displayed image (but don't update self.figsize) - if not self._isConfigured: - self._isConfigured = True - dpival = self.figure.dpi winch = self._width/dpival hinch = self._height/dpival self.figure.set_size_inches(winch, hinch) - if self._isRealized: - self.draw_idle() - evt.Skip() + # Rendering will happen on the associated paint event + # so no need to do anything here except to make sure + # the whole background is repainted. + self.Refresh(eraseBackground=False) def _get_key(self, evt): @@ -1288,8 +1292,6 @@ for figwin in Gcf.get_all_fig_managers(): figwin.frame.Show() - figwin.canvas.realize() - figwin.canvas.draw() if show._needmain and not matplotlib.is_interactive(): # start the wxPython gui event if there is not already one running @@ -1316,7 +1318,6 @@ frame = FigureFrameWx(num, fig) figmgr = frame.get_figure_manager() if matplotlib.is_interactive(): - figmgr.canvas.realize() figmgr.frame.Show() return figmgr @@ -1436,8 +1437,6 @@ def showfig(*args): frame.Show() - canvas.realize() - canvas.draw() # attach a show method to the figure self.canvas.figure.show = showfig @@ -1732,7 +1731,6 @@ except Exception, e: error_msg_wx(str(e)) - def set_cursor(self, cursor): cursor =wx.StockCursor(cursord[cursor]) self.canvas.SetCursor( cursor ) @@ -1999,9 +1997,6 @@ direction = -1 self.button_fn(direction) - def _onRedraw(self, evt): - self.canvas.draw() - _onSave = NavigationToolbar2Wx.save def _onClose(self, evt): Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wxagg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_wxagg.py 2008年07月27日 20:42:13 UTC (rev 5906) +++ trunk/matplotlib/lib/matplotlib/backends/backend_wxagg.py 2008年07月28日 07:26:47 UTC (rev 5907) @@ -52,7 +52,7 @@ size. """ - def draw(self, repaint=True): + def draw(self, drawDC=None): """ Render the figure using agg. """ @@ -60,8 +60,8 @@ FigureCanvasAgg.draw(self) self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None) - if repaint: - self.gui_repaint() + self._isDrawn = True + self.gui_repaint(drawDC=drawDC) def blit(self, bbox=None): """ @@ -97,8 +97,14 @@ filetypes = FigureCanvasAgg.filetypes def print_figure(self, filename, *args, **kwargs): + # Use pure Agg renderer to draw FigureCanvasAgg.print_figure(self, filename, *args, **kwargs) - self.draw() + # Restore the current view; this is needed because the + # artist contains methods rely on particular attributes + # of the rendered figure for determining things like + # bounding boxes. + if self._isDrawn: + self.draw() class NavigationToolbar2WxAgg(NavigationToolbar2Wx): def get_canvas(self, frame, fig): @@ -119,7 +125,6 @@ frame = FigureFrameWxAgg(num, fig) figmgr = frame.get_figure_manager() if matplotlib.is_interactive(): - figmgr.canvas.realize() figmgr.frame.Show() return figmgr This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5906 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5906&view=rev Author: pkienzle Date: 2008年07月27日 20:42:13 +0000 (2008年7月27日) Log Message: ----------- Fix wx event loops Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008年07月27日 20:36:10 UTC (rev 5905) +++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008年07月27日 20:42:13 UTC (rev 5906) @@ -719,9 +719,6 @@ bind(self, wx.EVT_LEAVE_WINDOW, self._onLeave) bind(self, wx.EVT_IDLE, self._onIdle) - # Event loop handler for start/stop event loop - self._event_loop = wx.EventLoop() - self.macros = {} # dict from wx id to seq of macros self.Printer_Init() @@ -932,12 +929,19 @@ This call blocks until a callback function triggers stop_event_loop() or *timeout* is reached. If *timeout* is <=0, never timeout. + + Raises RuntimeError if event loop is already running. """ + if hasattr(self, '_event_loop'): + raise RuntimeError("Event loop already running") id = wx.NewId() timer = wx.Timer(self, id=id) if timeout > 0: timer.Start(timeout*1000, oneShot=True) bind(self, wx.EVT_TIMER, self.stop_event_loop, id=id) + + # Event loop handler for start/stop event loop + self._event_loop = wx.EventLoop() self._event_loop.Run() timer.Stop() @@ -951,8 +955,10 @@ stop_event_loop_default(self) """ - if self._event_loop.IsRunning(): - self._event_loop.Exit() + if hasattr(self,'_event_loop'): + if self._event_loop.IsRunning(): + self._event_loop.Exit() + del self._event_loop def _get_imagesave_wildcards(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5905 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5905&view=rev Author: ryanmay Date: 2008年07月27日 20:36:10 +0000 (2008年7月27日) Log Message: ----------- Fix a doc typo. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axis.py Modified: trunk/matplotlib/lib/matplotlib/axis.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axis.py 2008年07月27日 20:33:45 UTC (rev 5904) +++ trunk/matplotlib/lib/matplotlib/axis.py 2008年07月27日 20:36:10 UTC (rev 5905) @@ -218,7 +218,7 @@ #if isinstance(a, mlines.Line2D): a.set_clip_box(self.axes.bbox) def get_view_interval(self): - 'return the view Interval instance for the axis tjis tick is ticking' + 'return the view Interval instance for the axis this tick is ticking' raise NotImplementedError('Derived must override') def set_view_interval(self, vmin, vmax, ignore=False): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5904 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5904&view=rev Author: ryanmay Date: 2008年07月27日 20:33:45 +0000 (2008年7月27日) Log Message: ----------- Fix a couple of docstring typos. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backend_bases.py Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backend_bases.py 2008年07月27日 17:18:30 UTC (rev 5903) +++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2008年07月27日 20:33:45 UTC (rev 5904) @@ -472,7 +472,7 @@ def get_clip_path(self): """ Return the clip path in the form (path, transform), where path - is a :class:`~matplotlib.path.Path` instance, and transform as + is a :class:`~matplotlib.path.Path` instance, and transform is an affine transform to apply to the path before clipping. """ if self._clippath is not None: @@ -653,7 +653,7 @@ class IdleEvent(Event): """ - An event triggered by the GUI backend when it is idel -- useful + An event triggered by the GUI backend when it is idle -- useful for passive animation """ pass This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5903 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5903&view=rev Author: efiring Date: 2008年07月27日 17:18:30 +0000 (2008年7月27日) Log Message: ----------- Change backend_wx function to backwards-compatible alias Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008年07月27日 05:13:23 UTC (rev 5902) +++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008年07月27日 17:18:30 UTC (rev 5903) @@ -731,7 +731,10 @@ # complete, reset the timer and continue. The # alternative approach, binding to wx.EVT_IDLE, # doesn't behave as nicely. - self.idletimer = wx.CallLater(1,self._onDrawIdle) + #self.idletimer = wx.CallLater(1,self._onDrawIdle) + self.idletimer = wx.FutureCall(1,self._onDrawIdle) + # FutureCall is a backwards-compatible alias; + # CallLater became available in 2.7.1.1. def Destroy(self, *args, **kwargs): wx.Panel.Destroy(self, *args, **kwargs) @@ -1051,7 +1054,7 @@ # Restore everything to normal self.bitmap = origBitmap - # Note: draw is required here since bits of state about the + # Note: draw is required here since bits of state about the # last renderer are strewn about the artist draw methods. Do # not remove the draw without first verifying that these have # been cleaned up. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5902 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5902&view=rev Author: jdh2358 Date: 2008年07月27日 05:13:23 +0000 (2008年7月27日) Log Message: ----------- added missing coverage report to backend driver Modified Paths: -------------- trunk/matplotlib/examples/pylab_examples/barcode_demo.py trunk/matplotlib/examples/tests/backend_driver.py Modified: trunk/matplotlib/examples/pylab_examples/barcode_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/barcode_demo.py 2008年07月27日 04:48:53 UTC (rev 5901) +++ trunk/matplotlib/examples/pylab_examples/barcode_demo.py 2008年07月27日 05:13:23 UTC (rev 5902) @@ -21,6 +21,6 @@ ax = fig.add_axes([0.3, 0.1, 0.6, 0.1], **axprops) ax.imshow(x, **barprops) -fig.savefig('barcode.png', dpi=100) +#fig.savefig('barcode.png', dpi=100) show() Modified: trunk/matplotlib/examples/tests/backend_driver.py =================================================================== --- trunk/matplotlib/examples/tests/backend_driver.py 2008年07月27日 04:48:53 UTC (rev 5901) +++ trunk/matplotlib/examples/tests/backend_driver.py 2008年07月27日 05:13:23 UTC (rev 5902) @@ -59,6 +59,7 @@ 'finance_demo.py', 'fonts_demo_kw.py', 'hexbin_demo.py', + 'hexbin_demo2.py', 'histogram_demo.py', 'hline_demo.py', 'image_demo.py', @@ -139,6 +140,34 @@ ] +# dict from dir to files we know we don't want to test (eg examples +# not using pyplot, examples requiring user input, animation examples, +# examples that may only work in certain environs (usetex examples?), +# examples that generate multiple figures + +excluded = { + pylab_dir : ['__init__.py', 'toggle_images.py',], + units_dir : ['__init__.py', 'date_support.py',], +} + +def report_missing(dir, flist): + 'report the py files in dir that are not in flist' + globstr = os.path.join(dir, '*.py') + fnames = glob.glob(globstr) + + pyfiles = set([os.path.split(fullpath)[-1] for fullpath in set(fnames)]) + + exclude = set(excluded.get(dir, [])) + flist = set(flist) + missing = list(pyfiles-flist-exclude) + missing.sort() + print '%s files not tested: %s'%(dir, ', '.join(missing)) + + +report_missing(pylab_dir, pylab_files) +report_missing(api_dir, api_files) +report_missing(units_dir, units_files) + files = [os.path.join(pylab_dir, fname) for fname in pylab_files] +\ [os.path.join(api_dir, fname) for fname in api_files] +\ [os.path.join(units_dir, fname) for fname in units_files] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5901 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5901&view=rev Author: jdh2358 Date: 2008年07月27日 04:48:53 +0000 (2008年7月27日) Log Message: ----------- fix backend driver typo Modified Paths: -------------- trunk/matplotlib/examples/tests/backend_driver.py Modified: trunk/matplotlib/examples/tests/backend_driver.py =================================================================== --- trunk/matplotlib/examples/tests/backend_driver.py 2008年07月27日 04:47:42 UTC (rev 5900) +++ trunk/matplotlib/examples/tests/backend_driver.py 2008年07月27日 04:48:53 UTC (rev 5901) @@ -34,7 +34,7 @@ 'bar_stacked.py', 'barchart_demo.py', 'barb_demo.py', - 'barcode_demo.py ', + 'barcode_demo.py', 'boxplot_demo.py', 'broken_barh.py', 'barh_demo.py', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5900 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5900&view=rev Author: jdh2358 Date: 2008年07月27日 04:47:42 +0000 (2008年7月27日) Log Message: ----------- commented out wide unicode line in stix example until we have a conditional check for wide char support Modified Paths: -------------- trunk/matplotlib/examples/pylab_examples/stix_fonts_demo.py trunk/matplotlib/examples/tests/backend_driver.py Modified: trunk/matplotlib/examples/pylab_examples/stix_fonts_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/stix_fonts_demo.py 2008年07月27日 02:11:05 UTC (rev 5899) +++ trunk/matplotlib/examples/pylab_examples/stix_fonts_demo.py 2008年07月27日 04:47:42 UTC (rev 5900) @@ -14,14 +14,14 @@ r'$\mathbf{\mathbb{Blackboard \pi}}$', r'$\mathfrak{Fraktur} \mathbf{\mathfrak{Fraktur}}$', r'$\mathscr{Script}$', - ur'Direct Unicode: $\u23ce \mathrm{\ue0f2 \U0001D538}$' +# ur'Direct Unicode: $\u23ce \mathrm{\ue0f2 \U0001D538}$' ] from pylab import * def doall(): tests = stests - + figure(figsize=(8, (len(tests) * 1) + 2)) plot([0, 0], 'r') grid(False) @@ -34,7 +34,7 @@ savefig('stix_fonts_example') #close('all') show() - + if '--latex' in sys.argv: fd = open("stix_fonts_examples.ltx", "w") fd.write("\\documentclass{article}\n") Modified: trunk/matplotlib/examples/tests/backend_driver.py =================================================================== --- trunk/matplotlib/examples/tests/backend_driver.py 2008年07月27日 02:11:05 UTC (rev 5899) +++ trunk/matplotlib/examples/tests/backend_driver.py 2008年07月27日 04:47:42 UTC (rev 5900) @@ -102,9 +102,11 @@ 'spy_demos.py', 'stem_plot.py', 'step_demo.py', + 'stix_fonts_demo.py', 'stock_demo.py', 'subplot_demo.py', -# 'set_and_get.py', + 'symlog_demo.py', + # 'set_and_get.py', 'table_demo.py', 'text_handles.py', 'text_rotation.py', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5899 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5899&view=rev Author: efiring Date: 2008年07月27日 02:11:05 +0000 (2008年7月27日) Log Message: ----------- Fix PolyCollection sizes kwarg docstring Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/collections.py Modified: trunk/matplotlib/lib/matplotlib/collections.py =================================================================== --- trunk/matplotlib/lib/matplotlib/collections.py 2008年07月27日 01:17:54 UTC (rev 5898) +++ trunk/matplotlib/lib/matplotlib/collections.py 2008年07月27日 02:11:05 UTC (rev 5899) @@ -573,8 +573,14 @@ *verts_i* is a sequence of *xy* tuples of vertices, or an equivalent :mod:`numpy` array of shape (*nv*, 2). - *sizes* gives the area of the circle circumscribing the - polygon in points^2. + *sizes* is *None* (default) or a sequence of floats that + scale the corresponding *verts_i*. The scaling is applied + before the Artist master transform; if the latter is an identity + transform, then the overall scaling is such that if + *verts_i* specify a unit square, then *sizes_i* is the area + of that square in points^2. + If len(*sizes*) < *nv*, the additional values will be + taken cyclically from the array. *closed*, when *True*, will explicitly close the polygon. @@ -601,8 +607,6 @@ return self._paths def draw(self, renderer): - # sizes is the area of the circle circumscribing the polygon - # in points^2 if self._sizes is not None: self._transforms = [ transforms.Affine2D().scale( @@ -679,8 +683,6 @@ __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd def draw(self, renderer): - # sizes is the area of the circle circumscribing the polygon - # in points^2 self._transforms = [ transforms.Affine2D().rotate(-self._rotation).scale( (np.sqrt(x) * self.figure.dpi / 72.0) / np.sqrt(np.pi)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5898 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5898&view=rev Author: astraw Date: 2008年07月27日 01:17:54 +0000 (2008年7月27日) Log Message: ----------- fix bug where reduce_C_function was being misapplied in hexbin() Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年07月27日 00:58:51 UTC (rev 5897) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年07月27日 01:17:54 UTC (rev 5898) @@ -5137,14 +5137,14 @@ for j in range(ny1): vals = lattice1[i,j] if len(vals): - lattice1[i,j] = reduce( reduce_C_function, vals ) + lattice1[i,j] = reduce_C_function( vals ) else: lattice1[i,j] = np.nan for i in range(nx2): for j in range(ny2): vals = lattice2[i,j] if len(vals): - lattice2[i,j] = reduce( reduce_C_function, vals ) + lattice2[i,j] = reduce_C_function( vals ) else: lattice2[i,j] = np.nan This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5897 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5897&view=rev Author: efiring Date: 2008年07月27日 00:58:51 +0000 (2008年7月27日) Log Message: ----------- Add contains method to QuiverKey Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/quiver.py Modified: trunk/matplotlib/lib/matplotlib/quiver.py =================================================================== --- trunk/matplotlib/lib/matplotlib/quiver.py 2008年07月27日 00:07:33 UTC (rev 5896) +++ trunk/matplotlib/lib/matplotlib/quiver.py 2008年07月27日 00:58:51 UTC (rev 5897) @@ -293,12 +293,22 @@ self.set_transform(self.Q.ax.figure.dpi_scale_trans) else: raise ValueError('unrecognized coordinates') - quiverkey_doc = _quiverkey_doc def set_figure(self, fig): martist.Artist.set_figure(self, fig) self.text.set_figure(fig) + def contains(self, mouseevent): + # Maybe the dictionary should allow one to + # distinguish between a text hit and a vector hit. + if (self.text.contains(mouseevent)[0] + or self.vector.contains(mouseevent)[0]): + return True, {} + return False, {} + + quiverkey_doc = _quiverkey_doc + + class Quiver(collections.PolyCollection): """ Specialized PolyCollection for arrows. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5896 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5896&view=rev Author: astraw Date: 2008年07月27日 00:07:33 +0000 (2008年7月27日) Log Message: ----------- Added optional C and reduce_C_function arguments to axes.hexbin(). Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/axes.py Added Paths: ----------- trunk/matplotlib/examples/pylab_examples/hexbin_demo2.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年07月26日 23:26:02 UTC (rev 5895) +++ trunk/matplotlib/CHANGELOG 2008年07月27日 00:07:33 UTC (rev 5896) @@ -1,3 +1,8 @@ +2008年07月26日 Added optional C and reduce_C_function arguments to + axes.hexbin(). This allows hexbin to accumulate the values + of C based on the x,y coordinates and display in hexagonal + bins. - ADS + 2008年07月24日 Deprecated (raise NotImplementedError) all the mlab2 functions from matplotlib.mlab out of concern that some of them were not clean room implementations. JDH Added: trunk/matplotlib/examples/pylab_examples/hexbin_demo2.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/hexbin_demo2.py (rev 0) +++ trunk/matplotlib/examples/pylab_examples/hexbin_demo2.py 2008年07月27日 00:07:33 UTC (rev 5896) @@ -0,0 +1,54 @@ +""" +hexbin is an axes method or pyplot function that is essentially a +pcolor of a 2-D histogram with hexagonal cells. +""" + +import numpy as np +import matplotlib.pyplot as plt +import matplotlib.mlab as mlab + +delta = 0.025 +x = y = np.arange(-3.0, 3.0, delta) +X, Y = np.meshgrid(x, y) +Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) +Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) +Z = Z2-Z1 # difference of Gaussians + +x = X.ravel() +y = Y.ravel() +z = Z.ravel() + +if 1: + # make some points 20 times more common than others, but same mean + xcond = (-1 < x) & (x < 1) + ycond = (-2 < y) & (y < 0) + cond = xcond & ycond + xnew = x[cond] + ynew = y[cond] + znew = z[cond] + for i in range(20): + x = np.hstack((x,xnew)) + y = np.hstack((y,ynew)) + z = np.hstack((z,znew)) + +xmin = x.min() +xmax = x.max() +ymin = y.min() +ymax = y.max() + +gridsize=30 + +plt.subplot(211) +plt.hexbin(x,y, C=z, gridsize=gridsize ) +plt.axis([xmin, xmax, ymin, ymax]) +cb = plt.colorbar() +cb.set_label('mean value') + +plt.subplot(212) +plt.hexbin(x,y, gridsize=gridsize ) +plt.axis([xmin, xmax, ymin, ymax]) +cb = plt.colorbar() +cb.set_label('N observations') + +plt.show() + Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年07月26日 23:26:02 UTC (rev 5895) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年07月27日 00:07:33 UTC (rev 5896) @@ -4941,24 +4941,35 @@ scatter.__doc__ = cbook.dedent(scatter.__doc__) % martist.kwdocd - def hexbin(self, x, y, gridsize = 100, bins = None, + def hexbin(self, x, y, C = None, gridsize = 100, bins = None, xscale = 'linear', yscale = 'linear', cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, edgecolors='none', + reduce_C_function = np.mean, **kwargs): """ call signature:: - hexbin(x, y, gridsize = 100, bins = None, + hexbin(x, y, C = None, gridsize = 100, bins = None, xscale = 'linear', yscale = 'linear', cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, edgecolors='none' + reduce_C_function = np.mean, **kwargs) Make a hexagonal binning plot of *x* versus *y*, where *x*, - *y* are 1-D sequences of the same length, *N*. + *y* are 1-D sequences of the same length, *N*. If *C* is None + (the default), this is a histogram of the number of occurences + of the observations at (x[i],y[i]). - *x* and/or *y* may be masked arrays, in which case only + If *C* is specified, it specifies values at the coordinate + (x[i],y[i]). These values are accumulated for each hexagonal + bin and then reduced according to *reduce_C_function*, which + defaults to numpy's mean function (np.mean). (If *C* is + specified, it must also be a 1-D sequence of the same length + as *x* and *y*.) + + *x*, *y* and/or *C* may be masked arrays, in which case only unmasked points will be plotted. Optional keyword arguments: @@ -5049,7 +5060,7 @@ self._process_unit_info(xdata=x, ydata=y, kwargs=kwargs) - x, y = cbook.delete_masked_points(x, y) + x, y, C = cbook.delete_masked_points(x, y, C) # Set the size of the hexagon grid if iterable(gridsize): @@ -5087,22 +5098,59 @@ nx2 = nx ny2 = ny n = nx1*ny1+nx2*ny2 - counts = np.zeros(n) - lattice1 = counts[:nx1*ny1] - lattice2 = counts[nx1*ny1:] - lattice1.shape = (nx1,ny1) - lattice2.shape = (nx2,ny2) d1 = (x-ix1)**2 + 3.0 * (y-iy1)**2 d2 = (x-ix2-0.5)**2 + 3.0 * (y-iy2-0.5)**2 bdist = (d1<d2) - for i in range(len(x)): - if bdist[i]: - lattice1[ix1[i], iy1[i]]+=1 - else: - lattice2[ix2[i], iy2[i]]+=1 + if C is None: + accum = np.zeros(n) + # Create appropriate views into "accum" array. + lattice1 = accum[:nx1*ny1] + lattice2 = accum[nx1*ny1:] + lattice1.shape = (nx1,ny1) + lattice2.shape = (nx2,ny2) + for i in range(len(x)): + if bdist[i]: + lattice1[ix1[i], iy1[i]]+=1 + else: + lattice2[ix2[i], iy2[i]]+=1 + else: + # create accumulation arrays + lattice1 = np.empty((nx1,ny1),dtype=object) + for i in range(nx1): + for j in range(ny1): + lattice1[i,j] = [] + lattice2 = np.empty((nx2,ny2),dtype=object) + for i in range(nx2): + for j in range(ny2): + lattice2[i,j] = [] + + for i in range(len(x)): + if bdist[i]: + lattice1[ix1[i], iy1[i]].append( C[i] ) + else: + lattice2[ix2[i], iy2[i]].append( C[i] ) + + for i in range(nx1): + for j in range(ny1): + vals = lattice1[i,j] + if len(vals): + lattice1[i,j] = reduce( reduce_C_function, vals ) + else: + lattice1[i,j] = np.nan + for i in range(nx2): + for j in range(ny2): + vals = lattice2[i,j] + if len(vals): + lattice2[i,j] = reduce( reduce_C_function, vals ) + else: + lattice2[i,j] = np.nan + + accum = np.hstack(( lattice1.astype(float).ravel(), lattice2.astype(float).ravel() )) + good_idxs = ~np.isnan(accum) + px = xmin + sx * np.array([ 0.5, 0.5, 0.0, -0.5, -0.5, 0.0]) py = ymin + sy * np.array([-0.5, 0.5, 1.0, 0.5, -0.5, -1.0]) / 3.0 @@ -5112,6 +5160,11 @@ polygons[:,nx1*ny1:,0] = np.repeat(np.arange(nx2) + 0.5, ny2) polygons[:,nx1*ny1:,1] = np.tile(np.arange(ny2), nx2) + 0.5 + if C is not None: + # remove accumulation bins with no data + polygons = polygons[:,good_idxs,:] + accum = accum[good_idxs] + polygons = np.transpose(polygons, axes=[1,0,2]) polygons[:,:,0] *= sx polygons[:,:,1] *= sy @@ -5150,20 +5203,20 @@ transOffset = self.transData, ) - # Transform the counts if needed + # Transform accum if needed if bins=='log': - counts = np.log10(counts+1) + accum = np.log10(accum+1) elif bins!=None: if not iterable(bins): - minimum, maximum = min(counts), max(counts) + minimum, maximum = min(accum), max(accum) bins-=1 # one less edge than bins bins = minimum + (maximum-minimum)*np.arange(bins)/bins bins = np.sort(bins) - counts = bins.searchsorted(counts) + accum = bins.searchsorted(accum) if norm is not None: assert(isinstance(norm, mcolors.Normalize)) if cmap is not None: assert(isinstance(cmap, mcolors.Colormap)) - collection.set_array(counts) + collection.set_array(accum) collection.set_cmap(cmap) collection.set_norm(norm) collection.set_alpha(alpha) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5895 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5895&view=rev Author: jdh2358 Date: 2008年07月26日 23:26:02 +0000 (2008年7月26日) Log Message: ----------- more broken example fixes Modified Paths: -------------- trunk/matplotlib/examples/pylab_examples/multi_image.py trunk/matplotlib/examples/tests/backend_driver.py Modified: trunk/matplotlib/examples/pylab_examples/multi_image.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/multi_image.py 2008年07月26日 23:11:54 UTC (rev 5894) +++ trunk/matplotlib/examples/pylab_examples/multi_image.py 2008年07月26日 23:26:02 UTC (rev 5895) @@ -50,17 +50,25 @@ # Set the first image as the master, with all the others # observing it for changes in cmap or norm. + +class ImageFollower: + 'update image in response to changes in clim or cmap on another image' + def __init__(self, follower): + self.follower = follower + def __call__(self, leader): + self.follower.set_cmap(leader.get_cmap()) + self.follower.set_clim(leader.get_clim()) + norm = colors.Normalize(vmin=vmin, vmax=vmax) for i, im in enumerate(images): im.set_norm(norm) if i > 0: - images[0].add_observer(im) + images[0].callbacksSM.connect('changed', ImageFollower(im)) # The colorbar is also based on this master image. fig.colorbar(images[0], cax, orientation='horizontal') # We need the following only if we want to run this -# script interactively and be able to change the colormap. sci(images[0]) Modified: trunk/matplotlib/examples/tests/backend_driver.py =================================================================== --- trunk/matplotlib/examples/tests/backend_driver.py 2008年07月26日 23:11:54 UTC (rev 5894) +++ trunk/matplotlib/examples/tests/backend_driver.py 2008年07月26日 23:26:02 UTC (rev 5895) @@ -43,6 +43,7 @@ 'contour_demo.py', 'contour_label_demo.py', 'contourf_demo.py', + 'geo_demo.py', 'griddata_demo.py', 'csd_demo.py', 'custom_ticker1.py', @@ -80,6 +81,7 @@ 'mathtext_demo.py', 'mri_with_eeg.py', 'multiple_figs_demo.py', + 'multi_image.py', 'nan_test.py', 'pcolor_demo.py', 'pcolor_demo2.py', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5894 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5894&view=rev Author: jdh2358 Date: 2008年07月26日 23:11:54 +0000 (2008年7月26日) Log Message: ----------- fixed a couple of examples Modified Paths: -------------- trunk/matplotlib/examples/pylab_examples/barcode_demo.py trunk/matplotlib/examples/tests/backend_driver.py trunk/matplotlib/lib/matplotlib/backends/backend_wxagg.py Modified: trunk/matplotlib/examples/pylab_examples/barcode_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/barcode_demo.py 2008年07月26日 22:23:06 UTC (rev 5893) +++ trunk/matplotlib/examples/pylab_examples/barcode_demo.py 2008年07月26日 23:11:54 UTC (rev 5894) @@ -15,6 +15,7 @@ ax = fig.add_axes([0.1, 0.3, 0.1, 0.6], **axprops) ax.imshow(x, **barprops) +x = x.copy() # a horizontal barcode x.shape = 1, len(x) ax = fig.add_axes([0.3, 0.1, 0.6, 0.1], **axprops) Modified: trunk/matplotlib/examples/tests/backend_driver.py =================================================================== --- trunk/matplotlib/examples/tests/backend_driver.py 2008年07月26日 22:23:06 UTC (rev 5893) +++ trunk/matplotlib/examples/tests/backend_driver.py 2008年07月26日 23:11:54 UTC (rev 5894) @@ -34,6 +34,7 @@ 'bar_stacked.py', 'barchart_demo.py', 'barb_demo.py', + 'barcode_demo.py ', 'boxplot_demo.py', 'broken_barh.py', 'barh_demo.py', Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wxagg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_wxagg.py 2008年07月26日 22:23:06 UTC (rev 5893) +++ trunk/matplotlib/lib/matplotlib/backends/backend_wxagg.py 2008年07月26日 23:11:54 UTC (rev 5894) @@ -41,7 +41,7 @@ toolbar = None return toolbar -class FigureCanvasWxAgg(FigureCanvasWx, FigureCanvasAgg): +class FigureCanvasWxAgg(FigureCanvasAgg, FigureCanvasWx): """ The FigureCanvas contains the figure and does event handling. @@ -95,11 +95,11 @@ self.gui_repaint() filetypes = FigureCanvasAgg.filetypes - + def print_figure(self, filename, *args, **kwargs): FigureCanvasAgg.print_figure(self, filename, *args, **kwargs) self.draw() - + class NavigationToolbar2WxAgg(NavigationToolbar2Wx): def get_canvas(self, frame, fig): return FigureCanvasWxAgg(frame, -1, fig) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5893 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5893&view=rev Author: pkienzle Date: 2008年07月26日 22:23:06 +0000 (2008年7月26日) Log Message: ----------- fix contains() method for Lines Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/lines.py Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2008年07月26日 19:32:47 UTC (rev 5892) +++ trunk/matplotlib/lib/matplotlib/lines.py 2008年07月26日 22:23:06 UTC (rev 5893) @@ -236,33 +236,43 @@ if not is_numlike(self.pickradius): raise ValueError,"pick radius should be a distance" + # Make sure we have data to plot if self._invalid: self.recache() if len(self._xy)==0: return False,{} - tpath = self._transformed_path.get_fully_transformed_path() - xyt = tpath.vertices - xt = xyt[:, 0] - yt = xyt[:, 1] + # Convert points to pixels + path, affine = self._transformed_path.get_transformed_path_and_affine() + path = affine.transform_path(path) + xy = path.vertices + xt = xy[:, 0] + yt = xy[:, 1] + + # Convert pick radius from points to pixels if self.figure == None: - print str(self),' has no figure set' + warning.warn('no figure set when check if mouse is on line') pixels = self.pickradius else: pixels = self.figure.dpi/72. * self.pickradius + # Check for collision if self._linestyle in ['None',None]: # If no line, return the nearby point(s) - d = np.sqrt((xt-mouseevent.x)**2 + (yt-mouseevent.y)**2) - ind, = np.nonzero(np.less_equal(d, pixels)) + d = (xt-mouseevent.x)**2 + (yt-mouseevent.y)**2 + ind, = np.nonzero(np.less_equal(d, pixels**2)) else: # If line, return the nearby segment(s) ind = segment_hits(mouseevent.x,mouseevent.y,xt,yt,pixels) - if 0: - print 'linestyle',self._linestyle - print 'xt', xt, mouseevent.x - print 'yt', yt, mouseevent.y - print 'dx,dy', (xt-mouseevent.x)**2., (yt-mouseevent.y)**2. + + # Debugging message + if False and self._label != u'': + print "Checking line",self._label,"at",mouseevent.x,mouseevent.y + print 'xt', xt + print 'yt', yt + #print 'dx,dy', (xt-mouseevent.x)**2., (yt-mouseevent.y)**2. print 'ind',ind + + # Return the point(s) within radius return len(ind)>0,dict(ind=ind) def get_pickradius(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5892 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5892&view=rev Author: pkienzle Date: 2008年07月26日 19:32:47 +0000 (2008年7月26日) Log Message: ----------- widgets.py: replace tabs with spaces Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/widgets.py Modified: trunk/matplotlib/lib/matplotlib/widgets.py =================================================================== --- trunk/matplotlib/lib/matplotlib/widgets.py 2008年07月26日 19:24:28 UTC (rev 5891) +++ trunk/matplotlib/lib/matplotlib/widgets.py 2008年07月26日 19:32:47 UTC (rev 5892) @@ -864,9 +864,9 @@ self.cids.append(self.canvas.mpl_connect('motion_notify_event', self.onmove)) self.cids.append(self.canvas.mpl_connect('button_press_event', self.press)) - self.cids.append(self.canvas.mpl_connect('button_release_event', self.release)) - self.cids.append(self.canvas.mpl_connect('draw_event', self.update_background)) - if self.direction == 'horizontal': + self.cids.append(self.canvas.mpl_connect('button_release_event', self.release)) + self.cids.append(self.canvas.mpl_connect('draw_event', self.update_background)) + if self.direction == 'horizontal': trans = blended_transform_factory(self.ax.transData, self.ax.transAxes) w,h = 0,1 else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.