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: 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.