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
|
2
|
3
|
4
(1) |
5
(6) |
6
(1) |
7
(5) |
8
(4) |
9
(7) |
10
(2) |
11
(12) |
12
(2) |
13
(1) |
14
(4) |
15
|
16
|
17
(7) |
18
(2) |
19
(3) |
20
(8) |
21
(6) |
22
|
23
(9) |
24
(4) |
25
(9) |
26
(2) |
27
|
28
|
29
(2) |
30
(1) |
|
|
|
|
|
|
Revision: 6458 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6458&view=rev Author: astraw Date: 2008年11月30日 18:33:55 +0000 (2008年11月30日) Log Message: ----------- axes.py: Shorten source code lines so all are less than 80 chars long. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年11月29日 21:14:26 UTC (rev 6457) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年11月30日 18:33:55 UTC (rev 6458) @@ -266,7 +266,8 @@ ret = [] if is_string_like(tup2[1]): - assert self.command == 'plot', 'fill needs at least 2 non-string arguments' + assert self.command == 'plot', ('fill needs at least 2 non-string ' + 'arguments') y, fmt = tup2 x, y, multicol = self._xy_from_y(y) @@ -545,10 +546,12 @@ if len(kwargs): martist.setp(self, **kwargs) if self.xaxis is not None: - self._xcid = self.xaxis.callbacks.connect('units finalize', self.relim) + self._xcid = self.xaxis.callbacks.connect('units finalize', + self.relim) if self.yaxis is not None: - self._ycid = self.yaxis.callbacks.connect('units finalize', self.relim) + self._ycid = self.yaxis.callbacks.connect('units finalize', + self.relim) def get_window_extent(self, *args, **kwargs): ''' @@ -575,7 +578,8 @@ #these will be updated later as data is added self.dataLim = mtransforms.Bbox.unit() self.viewLim = mtransforms.Bbox.unit() - self.transScale = mtransforms.TransformWrapper(mtransforms.IdentityTransform()) + self.transScale = mtransforms.TransformWrapper( + mtransforms.IdentityTransform()) self._set_lim_and_transforms() @@ -590,7 +594,8 @@ # Transforms the x and y axis separately by a scale factor # It is assumed that this part will have non-linear components - self.transScale = mtransforms.TransformWrapper(mtransforms.IdentityTransform()) + self.transScale = mtransforms.TransformWrapper( + mtransforms.IdentityTransform()) # An affine transformation on the data, generally to limit the # range of the axes @@ -815,7 +820,8 @@ self.yaxis.cla() self.ignore_existing_data_limits = True - self.callbacks = cbook.CallbackRegistry(('xlim_changed', 'ylim_changed')) + self.callbacks = cbook.CallbackRegistry(('xlim_changed', + 'ylim_changed')) if self._sharex is not None: # major and minor are class instances with @@ -1128,7 +1134,8 @@ changey = (self in self._shared_x_axes and self not in self._shared_y_axes) if changex and changey: - warnings.warn("adjustable='datalim' cannot work with shared x and y axes") + warnings.warn("adjustable='datalim' cannot work with shared " + "x and y axes") return if changex: adjust_y = False @@ -1187,7 +1194,8 @@ self.set_aspect('equal', adjustable='box', anchor='C') else: - raise ValueError('Unrecognized string %s to axis; try on or off' % s) + raise ValueError('Unrecognized string %s to axis; ' + 'try on or off' % s) xmin, xmax = self.get_xlim() ymin, ymax = self.get_ylim() return xmin, xmax, ymin, ymax @@ -1439,7 +1447,8 @@ if xunits!=self.xaxis.units: #print '\tkw setting xunits', xunits self.xaxis.set_units(xunits) - # If the units being set imply a different converter, we need to update. + # If the units being set imply a different converter, + # we need to update. if xdata is not None: self.xaxis.update_units(xdata) @@ -1447,7 +1456,8 @@ if yunits!=self.yaxis.units: #print '\tkw setting yunits', yunits self.yaxis.set_units(yunits) - # If the units being set imply a different converter, we need to update. + # If the units being set imply a different converter, + # we need to update. if ydata is not None: self.yaxis.update_units(ydata) @@ -1875,7 +1885,8 @@ for other in self._shared_x_axes.get_siblings(self): if other is not self: other.set_xlim(self.viewLim.intervalx, emit=False) - if other.figure != self.figure and other.figure.canvas is not None: + if (other.figure != self.figure and + other.figure.canvas is not None): other.figure.canvas.draw_idle() return xmin, xmax @@ -1920,15 +1931,18 @@ def get_xmajorticklabels(self): 'Get the xtick labels as a list of Text instances' - return cbook.silent_list('Text xticklabel', self.xaxis.get_majorticklabels()) + return cbook.silent_list('Text xticklabel', + self.xaxis.get_majorticklabels()) def get_xminorticklabels(self): 'Get the xtick labels as a list of Text instances' - return cbook.silent_list('Text xticklabel', self.xaxis.get_minorticklabels()) + return cbook.silent_list('Text xticklabel', + self.xaxis.get_minorticklabels()) def get_xticklabels(self, minor=False): 'Get the xtick labels as a list of Text instances' - return cbook.silent_list('Text xticklabel', self.xaxis.get_ticklabels(minor=minor)) + return cbook.silent_list('Text xticklabel', + self.xaxis.get_ticklabels(minor=minor)) def set_xticklabels(self, labels, fontdict=None, minor=False, **kwargs): """ @@ -1945,8 +1959,10 @@ ACCEPTS: sequence of strings """ - return self.xaxis.set_ticklabels(labels, fontdict, minor=minor, **kwargs) - set_xticklabels.__doc__ = cbook.dedent(set_xticklabels.__doc__) % martist.kwdocd + return self.xaxis.set_ticklabels(labels, fontdict, + minor=minor, **kwargs) + set_xticklabels.__doc__ = cbook.dedent( + set_xticklabels.__doc__) % martist.kwdocd def invert_yaxis(self): "Invert the y-axis." @@ -1959,7 +1975,7 @@ return right < left def get_ybound(self): - "Returns the y-axis numerical bounds in the form of lowerBound < upperBound" + "Return y-axis numerical bounds in the form of lowerBound < upperBound" left, right = self.get_ylim() if left < right: return left, right @@ -2044,7 +2060,8 @@ for other in self._shared_y_axes.get_siblings(self): if other is not self: other.set_ylim(self.viewLim.intervaly, emit=False) - if other.figure != self.figure and other.figure.canvas is not None: + if (other.figure != self.figure and + other.figure.canvas is not None): other.figure.canvas.draw_idle() return ymin, ymax @@ -2093,15 +2110,18 @@ def get_ymajorticklabels(self): 'Get the xtick labels as a list of Text instances' - return cbook.silent_list('Text yticklabel', self.yaxis.get_majorticklabels()) + return cbook.silent_list('Text yticklabel', + self.yaxis.get_majorticklabels()) def get_yminorticklabels(self): 'Get the xtick labels as a list of Text instances' - return cbook.silent_list('Text yticklabel', self.yaxis.get_minorticklabels()) + return cbook.silent_list('Text yticklabel', + self.yaxis.get_minorticklabels()) def get_yticklabels(self, minor=False): 'Get the xtick labels as a list of Text instances' - return cbook.silent_list('Text yticklabel', self.yaxis.get_ticklabels(minor=minor)) + return cbook.silent_list('Text yticklabel', + self.yaxis.get_ticklabels(minor=minor)) def set_yticklabels(self, labels, fontdict=None, minor=False, **kwargs): """ @@ -2118,8 +2138,10 @@ ACCEPTS: sequence of strings """ - return self.yaxis.set_ticklabels(labels, fontdict, minor=minor, **kwargs) - set_yticklabels.__doc__ = cbook.dedent(set_yticklabels.__doc__) % martist.kwdocd + return self.yaxis.set_ticklabels(labels, fontdict, + minor=minor, **kwargs) + set_yticklabels.__doc__ = cbook.dedent( + set_yticklabels.__doc__) % martist.kwdocd def xaxis_date(self, tz=None): """Sets up x-axis ticks and labels that treat the x data as dates. @@ -2412,11 +2434,13 @@ disconnect to disconnect from the axes event """ - raise DeprecationWarning('use the callbacks CallbackRegistry instance instead') + raise DeprecationWarning('use the callbacks CallbackRegistry instance ' + 'instead') def disconnect(self, cid): 'disconnect from the Axes event.' - raise DeprecationWarning('use the callbacks CallbackRegistry instance instead') + raise DeprecationWarning('use the callbacks CallbackRegistry instance ' + 'instead') def get_children(self): 'return a list of child artists' @@ -2456,8 +2480,8 @@ the artist and the artist has picker set """ if len(args)>1: - raise DeprecationWarning( - 'New pick API implemented -- see API_CHANGES in the src distribution') + raise DeprecationWarning('New pick API implemented -- ' + 'see API_CHANGES in the src distribution') martist.Artist.pick(self,args[0]) def __pick(self, x, y, trans=None, among=None): @@ -2773,7 +2797,8 @@ ymin, ymax = self.get_ybound() - # We need to strip away the units for comparison with non-unitized bounds + # We need to strip away the units for comparison with + # non-unitized bounds yy = self.convert_yunits( y ) scaley = (yy<ymin) or (yy>ymax) @@ -2831,7 +2856,8 @@ xmin, xmax = self.get_xbound() - # We need to strip away the units for comparison with non-unitized bounds + # We need to strip away the units for comparison with + # non-unitized bounds xx = self.convert_xunits( x ) scalex = (xx<xmin) or (xx>xmax) @@ -2993,8 +3019,9 @@ .. plot:: mpl_examples/pylab_examples/hline_demo.py """ if kwargs.get('fmt') is not None: - raise DeprecationWarning( - 'hlines now uses a collections.LineCollection and not a list of Line2D to draw; see API_CHANGES') + raise DeprecationWarning('hlines now uses a ' + 'collections.LineCollection and not a ' + 'list of Line2D to draw; see API_CHANGES') # We do the conversion first since not all unitized data is uniform y = self.convert_yunits( y ) @@ -3069,8 +3096,9 @@ """ if kwargs.get('fmt') is not None: - raise DeprecationWarning( - 'vlines now uses a collections.LineCollection and not a list of Line2D to draw; see API_CHANGES') + raise DeprecationWarning('vlines now uses a ' + 'collections.LineCollection and not a ' + 'list of Line2D to draw; see API_CHANGES') self._process_unit_info(xdata=x, ydata=ymin, kwargs=kwargs) @@ -3128,10 +3156,10 @@ optional format string. For example, each of the following is legal:: - plot(x, y) # plot x and y using the default line style and color - plot(x, y, 'bo') # plot x and y using blue circle markers - plot(y) # plot y using x as index array 0..N-1 - plot(y, 'r+') # ditto, but with red plusses + plot(x, y) # plot x and y using default line style and color + plot(x, y, 'bo') # plot x and y using blue circle markers + plot(y) # plot y using x as index array 0..N-1 + plot(y, 'r+') # ditto, but with red plusses If *x* and/or *y* is 2-dimensional, then the corresponding columns will be plotted. @@ -3247,8 +3275,8 @@ the *x* or *y* (or both) data is considered to be dates, and the axis is labeled accordingly. - *x* and/or *y* can be a sequence of dates represented as float days since - 0001年01月01日 UTC. + *x* and/or *y* can be a sequence of dates represented as float + days since 0001年01月01日 UTC. Keyword arguments: @@ -3317,7 +3345,8 @@ :func:`~matplotlib.pyplot.loglog` supports all the keyword arguments of :func:`~matplotlib.pyplot.plot` and - :meth:`matplotlib.axes.Axes.set_xscale`/:meth:`matplotlib.axes.Axes.set_yscale`. + :meth:`matplotlib.axes.Axes.set_xscale` / + :meth:`matplotlib.axes.Axes.set_yscale`. Notable keyword arguments: @@ -3327,9 +3356,8 @@ *subsx*/*subsy*: [ None | sequence ] the location of the minor *x*/*y* ticks; *None* defaults to autosubs, which depend on the number of decades in the - plot; see - :meth:`matplotlib.axes.Axes.set_xscale`/:meth:`matplotlib.axes.Axes.set_yscale` - for details + plot; see :meth:`matplotlib.axes.Axes.set_xscale` / + :meth:`matplotlib.axes.Axes.set_yscale` for details The remaining valid kwargs are :class:`~matplotlib.lines.Line2D` properties: @@ -3497,8 +3525,9 @@ - *b* is the *x*-axis. .. seealso:: - :meth:`~matplotlib.axes.Axes.plot` or :meth:`~matplotlib.axes.Axes.vlines`: - For documentation on valid kwargs. + :meth:`~matplotlib.axes.Axes.plot` or + :meth:`~matplotlib.axes.Axes.vlines`: For documentation on + valid kwargs. **Example:** @@ -3512,8 +3541,8 @@ return self.xcorr(x, x, **kwargs) acorr.__doc__ = cbook.dedent(acorr.__doc__) % martist.kwdocd - def xcorr(self, x, y, normed=False, detrend=mlab.detrend_none, usevlines=False, - maxlags=None, **kwargs): + def xcorr(self, x, y, normed=False, detrend=mlab.detrend_none, + usevlines=False, maxlags=None, **kwargs): """ call signature:: @@ -3581,7 +3610,8 @@ if maxlags is None: maxlags = Nx - 1 if maxlags >= Nx or maxlags < 1: - raise ValueError('maglags must be None or strictly positive < %d'%Nx) + raise ValueError('maglags must be None or strictly ' + 'positive < %d'%Nx) lags = np.arange(-maxlags,maxlags+1) c = c[Nx-1-maxlags:Nx+maxlags] @@ -3723,11 +3753,13 @@ labels = [] for handle in get_handles(): label = handle.get_label() - if label is not None and label != '' and not label.startswith('_'): + if (label is not None and + label != '' and not label.startswith('_')): handles.append(handle) labels.append(label) if len(handles) == 0: - warnings.warn("No labeled objects found. Use label='...' kwarg on individual plots.") + warnings.warn("No labeled objects found. " + "Use label='...' kwarg on individual plots.") return None elif len(args)==1: @@ -3784,7 +3816,8 @@ where = kwargs.pop('where', 'pre') if where not in ('pre', 'post', 'mid'): - raise ValueError("'where' argument to step must be 'pre', 'post' or 'mid'") + raise ValueError("'where' argument to step must be " + "'pre', 'post' or 'mid'") kwargs['linestyle'] = 'steps-' + where return self.plot(x, y, *args, **kwargs) @@ -3960,18 +3993,24 @@ # FIXME: convert the following to proper input validation # raising ValueError; don't use assert for this. assert len(left)==nbars, "argument 'left' must be %d or scalar" % nbars - assert len(height)==nbars, "argument 'height' must be %d or scalar" % nbars - assert len(width)==nbars, "argument 'width' must be %d or scalar" % nbars - assert len(bottom)==nbars, "argument 'bottom' must be %d or scalar" % nbars + assert len(height)==nbars, ("argument 'height' must be %d or scalar" % + nbars) + assert len(width)==nbars, ("argument 'width' must be %d or scalar" % + nbars) + assert len(bottom)==nbars, ("argument 'bottom' must be %d or scalar" % + nbars) if yerr is not None and len(yerr)!=nbars: - raise ValueError("bar() argument 'yerr' must be len(%s) or scalar" % nbars) + raise ValueError( + "bar() argument 'yerr' must be len(%s) or scalar" % nbars) if xerr is not None and len(xerr)!=nbars: - raise ValueError("bar() argument 'xerr' must be len(%s) or scalar" % nbars) + raise ValueError( + "bar() argument 'xerr' must be len(%s) or scalar" % nbars) patches = [] - # lets do some conversions now since some types cannot be subtracted uniformly + # lets do some conversions now since some types cannot be + # subtracted uniformly if self.xaxis is not None: xconv = self.xaxis.converter if xconv is not None: @@ -4189,12 +4228,13 @@ *baseline*). .. seealso:: - `this document - <http://www.mathworks.com/access/helpdesk/help/techdoc/ref/stem.html>`_: - for details + `this document`__ for details :file:`examples/pylab_examples/stem_plot.py`: for a demo + + __ http://www.mathworks.com/access/helpdesk/help/techdoc/ref/stem.html + """ remember_hold=self._hold if not self._hold: self.cla() @@ -4344,7 +4384,8 @@ elif callable(autopct): s = autopct(100.*frac) else: - raise TypeError('autopct must be callable or a format string') + raise TypeError( + 'autopct must be callable or a format string') t = self.text(xt, yt, s, horizontalalignment='center', @@ -4449,7 +4490,8 @@ self._process_unit_info(xdata=x, ydata=y, kwargs=kwargs) if not self._hold: self.cla() - # make sure all the args are iterable; use lists not arrays to preserve units + # make sure all the args are iterable; use lists not arrays to + # preserve units if not iterable(x): x = [x] @@ -4521,14 +4563,19 @@ plot_kw['transform'] = kwargs['transform'] if xerr is not None: - if iterable(xerr) and len(xerr)==2 and iterable(xerr[0]) and iterable(xerr[1]): + if (iterable(xerr) and len(xerr)==2 and + iterable(xerr[0]) and iterable(xerr[1])): # using list comps rather than arrays to preserve units - left = [thisx-thiserr for (thisx, thiserr) in cbook.safezip(x,xerr[0])] - right = [thisx+thiserr for (thisx, thiserr) in cbook.safezip(x,xerr[1])] + left = [thisx-thiserr for (thisx, thiserr) + in cbook.safezip(x,xerr[0])] + right = [thisx+thiserr for (thisx, thiserr) + in cbook.safezip(x,xerr[1])] else: # using list comps rather than arrays to preserve units - left = [thisx-thiserr for (thisx, thiserr) in cbook.safezip(x,xerr)] - right = [thisx+thiserr for (thisx, thiserr) in cbook.safezip(x,xerr)] + left = [thisx-thiserr for (thisx, thiserr) + in cbook.safezip(x,xerr)] + right = [thisx+thiserr for (thisx, thiserr) + in cbook.safezip(x,xerr)] barcols.append( self.hlines(y, left, right, **lines_kw ) ) if capsize > 0: @@ -4537,7 +4584,9 @@ # y are lists leftlo, ylo = xywhere(left, y, xlolims) - caplines.extend( self.plot(leftlo, ylo, ls='None', marker=mlines.CARETLEFT, **plot_kw) ) + caplines.extend( + self.plot(leftlo, ylo, ls='None', + marker=mlines.CARETLEFT, **plot_kw) ) xlolims = ~xlolims leftlo, ylo = xywhere(left, y, xlolims) caplines.extend( self.plot(leftlo, ylo, 'k|', **plot_kw) ) @@ -4547,7 +4596,9 @@ if xuplims.any(): rightup, yup = xywhere(right, y, xuplims) - caplines.extend( self.plot(rightup, yup, ls='None', marker=mlines.CARETRIGHT, **plot_kw) ) + caplines.extend( + self.plot(rightup, yup, ls='None', + marker=mlines.CARETRIGHT, **plot_kw) ) xuplims = ~xuplims rightup, yup = xywhere(right, y, xuplims) caplines.extend( self.plot(rightup, yup, 'k|', **plot_kw) ) @@ -4555,21 +4606,28 @@ caplines.extend( self.plot(right, y, 'k|', **plot_kw) ) if yerr is not None: - if iterable(yerr) and len(yerr)==2 and iterable(yerr[0]) and iterable(yerr[1]): + if (iterable(yerr) and len(yerr)==2 and + iterable(yerr[0]) and iterable(yerr[1])): # using list comps rather than arrays to preserve units - lower = [thisy-thiserr for (thisy, thiserr) in cbook.safezip(y,yerr[0])] - upper = [thisy+thiserr for (thisy, thiserr) in cbook.safezip(y,yerr[1])] + lower = [thisy-thiserr for (thisy, thiserr) + in cbook.safezip(y,yerr[0])] + upper = [thisy+thiserr for (thisy, thiserr) + in cbook.safezip(y,yerr[1])] else: # using list comps rather than arrays to preserve units - lower = [thisy-thiserr for (thisy, thiserr) in cbook.safezip(y,yerr)] - upper = [thisy+thiserr for (thisy, thiserr) in cbook.safezip(y,yerr)] + lower = [thisy-thiserr for (thisy, thiserr) + in cbook.safezip(y,yerr)] + upper = [thisy+thiserr for (thisy, thiserr) + in cbook.safezip(y,yerr)] barcols.append( self.vlines(x, lower, upper, **lines_kw) ) if capsize > 0: if lolims.any(): xlo, lowerlo = xywhere(x, lower, lolims) - caplines.extend( self.plot(xlo, lowerlo, ls='None', marker=mlines.CARETDOWN, **plot_kw) ) + caplines.extend( + self.plot(xlo, lowerlo, ls='None', + marker=mlines.CARETDOWN, **plot_kw) ) lolims = ~lolims xlo, lowerlo = xywhere(x, lower, lolims) caplines.extend( self.plot(xlo, lowerlo, 'k_', **plot_kw) ) @@ -4579,7 +4637,9 @@ if uplims.any(): xup, upperup = xywhere(x, upper, uplims) - caplines.extend( self.plot(xup, upperup, ls='None', marker=mlines.CARETUP, **plot_kw) ) + caplines.extend( + self.plot(xup, upperup, ls='None', + marker=mlines.CARETUP, **plot_kw) ) uplims = ~uplims xup, upperup = xywhere(x, upper, uplims) caplines.extend( self.plot(xup, upperup, 'k_', **plot_kw) ) @@ -4962,8 +5022,9 @@ edgecolors = None else: edgecolors = 'none' - warnings.warn('''replace "faceted=False" with "edgecolors='none'"''', - DeprecationWarning) #2008年04月18日 + warnings.warn( + '''replace "faceted=False" with "edgecolors='none'"''', + DeprecationWarning) #2008年04月18日 sym = None symstyle = 0 @@ -5302,7 +5363,8 @@ else: lattice2[i,j] = np.nan - accum = np.hstack(( lattice1.astype(float).ravel(), lattice2.astype(float).ravel() )) + 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]) @@ -5734,7 +5796,8 @@ Y = y.repeat(Nx, axis=1) if X.shape != Y.shape: raise TypeError( - 'Incompatible X, Y inputs to %s; see help(%s)' % (funcname, funcname)) + 'Incompatible X, Y inputs to %s; see help(%s)' % ( + funcname, funcname)) return X, Y, C def pcolor(self, *args, **kwargs): @@ -6025,7 +6088,8 @@ Ny, Nx = X.shape # convert to one dimensional arrays - C = ma.ravel(C[0:Ny-1, 0:Nx-1]) # data point in each cell is value at lower left corner + C = ma.ravel(C[0:Ny-1, 0:Nx-1]) # data point in each cell is value at + # lower left corner X = X.ravel() Y = Y.ravel() @@ -6039,7 +6103,8 @@ showedges = 0 collection = mcoll.QuadMesh( - Nx - 1, Ny - 1, coords, showedges, antialiased=antialiased) # kwargs are not used + Nx - 1, Ny - 1, coords, showedges, + antialiased=antialiased) # kwargs are not used collection.set_alpha(alpha) collection.set_array(C) if norm is not None: assert(isinstance(norm, mcolors.Normalize)) @@ -6184,7 +6249,8 @@ # convert to one dimensional arrays # This should also be moved to the QuadMesh class - C = ma.ravel(C) # data point in each cell is value at lower left corner + C = ma.ravel(C) # data point in each cell is value + # at lower left corner X = x.ravel() Y = y.ravel() Nx = nc+1 @@ -6446,7 +6512,8 @@ if kwargs.get('width') is not None: raise DeprecationWarning( - 'hist now uses the rwidth to give relative width and not absolute width') + 'hist now uses the rwidth to give relative width ' + 'and not absolute width') try: # make sure a copy is created: don't use asarray @@ -6454,7 +6521,8 @@ if len(x.shape)==1: x.shape = (1,x.shape[0]) elif len(x.shape)==2 and x.shape[1]<x.shape[0]: - warnings.warn('2D hist should be nsamples x nvariables; this looks transposed') + warnings.warn('2D hist should be nsamples x nvariables; ' + 'this looks transposed') except ValueError: # multiple hist with data of different length if iterable(x[0]) and not is_string_like(x[0]): @@ -6957,7 +7025,8 @@ mask = np.absolute(Z)>precision if 'cmap' not in kwargs: - kwargs['cmap'] = mcolors.ListedColormap(['w', 'k'], name='binary') + kwargs['cmap'] = mcolors.ListedColormap(['w', 'k'], + name='binary') nr, nc = Z.shape extent = [-0.5, nc-0.5, nr-0.5, -0.5] ret = self.imshow(mask, interpolation='nearest', aspect=aspect, @@ -7072,7 +7141,8 @@ total = rows*cols - num -= 1 # convert from matlab to python indexing ie num in range(0,total) + num -= 1 # convert from matlab to python indexing + # ie num in range(0,total) if num >= total: raise ValueError( 'Subplot number exceeds total subplots') self._rows = rows @@ -7125,7 +7195,8 @@ figBottom = top - (rowNum+1)*figH - rowNum*sepH figLeft = left + colNum*(figW + sepW) - self.figbox = mtransforms.Bbox.from_bounds(figLeft, figBottom, figW, figH) + self.figbox = mtransforms.Bbox.from_bounds(figLeft, figBottom, + figW, figH) self.rowNum = rowNum self.colNum = colNum self.numRows = rows This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6457 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6457&view=rev Author: dsdale Date: 2008年11月29日 21:14:26 +0000 (2008年11月29日) Log Message: ----------- added support for leave_notify_event in backend_qt4 Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py 2008年11月29日 02:20:56 UTC (rev 6456) +++ trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py 2008年11月29日 21:14:26 UTC (rev 6457) @@ -105,6 +105,9 @@ def __timerEvent(self, event): # hide until we can test and fix self.mpl_idle_event(event) + + def leaveEvent(self, event): + FigureCanvasBase.leave_notify_event(self, event) def mousePressEvent( self, event ): x = event.pos().x() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6456 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6456&view=rev Author: efiring Date: 2008年11月29日 02:20:56 +0000 (2008年11月29日) Log Message: ----------- Make scale colors match line colors in two_scales.py Modified Paths: -------------- trunk/matplotlib/examples/api/two_scales.py Modified: trunk/matplotlib/examples/api/two_scales.py =================================================================== --- trunk/matplotlib/examples/api/two_scales.py 2008年11月26日 18:59:58 UTC (rev 6455) +++ trunk/matplotlib/examples/api/two_scales.py 2008年11月29日 02:20:56 UTC (rev 6456) @@ -30,13 +30,17 @@ s1 = np.exp(t) ax1.plot(t, s1, 'b-') ax1.set_xlabel('time (s)') -ax1.set_ylabel('exp') +# Make the y-axis label and tick labels match the line color. +ax1.set_ylabel('exp', color='b') +for tl in ax1.get_yticklabels(): + tl.set_color('b') -# turn off the 2nd axes rectangle with frameon kwarg ax2 = ax1.twinx() s2 = np.sin(2*np.pi*t) ax2.plot(t, s2, 'r.') -ax2.set_ylabel('sin') +ax2.set_ylabel('sin', color='r') +for tl in ax2.get_yticklabels(): + tl.set_color('r') plt.show() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6455 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6455&view=rev Author: jdh2358 Date: 2008年11月26日 18:59:58 +0000 (2008年11月26日) Log Message: ----------- fixed leave_notify_event for gtk -- need support for other UIs Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backend_bases.py trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backend_bases.py 2008年11月26日 17:43:09 UTC (rev 6454) +++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2008年11月26日 18:59:58 UTC (rev 6455) @@ -744,7 +744,7 @@ ydata = None # y coord of mouse in data coords # the last event that was triggered before this one - _lastevent = None + lastevent = None def __init__(self, name, canvas, x, y,guiEvent=None): """ @@ -789,11 +789,10 @@ def _update_enter_leave(self): 'process the figure/axes enter leave events' - if LocationEvent._lastevent is not None: - last = LocationEvent._lastevent + if LocationEvent.lastevent is not None: + last = LocationEvent.lastevent if last.canvas!=self.canvas: # process figure enter/leave event - last.canvas.callbacks.process('figure_leave_event', last) self.canvas.callbacks.process('figure_enter_event', self) if last.inaxes!=self.inaxes: # process axes enter/leave events @@ -810,7 +809,7 @@ self.canvas.callbacks.process('axes_enter_event', self) - LocationEvent._lastevent = self + LocationEvent.lastevent = self @@ -1205,6 +1204,19 @@ guiEvent=guiEvent) self.callbacks.process(s, event) + def leave_notify_event(self, guiEvent=None): + """ + Backend derived classes should call this function when leaving + canvas + + *guiEvent* + the native UI event that generated the mpl event + + """ + self.callbacks.process('figure_leave_event', LocationEvent.lastevent) + LocationEvent.lastevent = None + + def idle_event(self, guiEvent=None): 'call when GUI is idle' s = 'idle_event' Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2008年11月26日 17:43:09 UTC (rev 6454) +++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2008年11月26日 18:59:58 UTC (rev 6455) @@ -170,6 +170,7 @@ self.connect('key_press_event', self.key_press_event) self.connect('key_release_event', self.key_release_event) self.connect('motion_notify_event', self.motion_notify_event) + self.connect('leave_notify_event', self.leave_notify_event) self.set_events(self.__class__.event_mask) @@ -239,6 +240,9 @@ FigureCanvasBase.motion_notify_event(self, x, y) return False # finish event propagation? + def leave_notify_event(self, widget, event): + FigureCanvasBase.leave_notify_event(self, event) + def _get_key(self, event): if event.keyval in self.keyvald: key = self.keyvald[event.keyval] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6454 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6454&view=rev Author: jdh2358 Date: 2008年11月26日 17:43:09 +0000 (2008年11月26日) Log Message: ----------- added figure/axes enter/leave events Modified Paths: -------------- trunk/matplotlib/doc/users/event_handling.rst trunk/matplotlib/lib/matplotlib/backend_bases.py Added Paths: ----------- trunk/matplotlib/examples/event_handling/figure_axes_enter_leave.py Modified: trunk/matplotlib/doc/users/event_handling.rst =================================================================== --- trunk/matplotlib/doc/users/event_handling.rst 2008年11月25日 21:43:36 UTC (rev 6453) +++ trunk/matplotlib/doc/users/event_handling.rst 2008年11月26日 17:43:09 UTC (rev 6454) @@ -53,15 +53,19 @@ ======================= ====================================================================================== Event name Class and description ======================= ====================================================================================== -'button_press_event' :class:`~matplotlib.backend_bases.MouseEvent` - mouse button is pressed -'button_release_event' :class:`~matplotlib.backend_bases.MouseEvent` - mouse button is released -'draw_event' :class:`~matplotlib.backend_bases.DrawEvent` - canvas draw -'key_press_event' :class:`~matplotlib.backend_bases.KeyEvent` - key is pressed -'key_release_event' :class:`~matplotlib.backend_bases.KeyEvent` - key is released -'motion_notify_event' :class:`~matplotlib.backend_bases.MouseEvent` - mouse motion -'pick_event' :class:`~matplotlib.backend_bases.PickEvent` - an object in the canvas is selected -'resize_event' :class:`~matplotlib.backend_bases.ResizeEvent` - figure canvas is resized -'scroll_event' :class:`~matplotlib.backend_bases.MouseEvent` - mouse scroll wheel is rolled +'button_press_event' :class:`~matplotlib.backend_bases.MouseEvent` - mouse button is pressed +'button_release_event' :class:`~matplotlib.backend_bases.MouseEvent` - mouse button is released +'draw_event' :class:`~matplotlib.backend_bases.DrawEvent` - canvas draw +'key_press_event' :class:`~matplotlib.backend_bases.KeyEvent` - key is pressed +'key_release_event' :class:`~matplotlib.backend_bases.KeyEvent` - key is released +'motion_notify_event' :class:`~matplotlib.backend_bases.MouseEvent` - mouse motion +'pick_event' :class:`~matplotlib.backend_bases.PickEvent` - an object in the canvas is selected +'resize_event' :class:`~matplotlib.backend_bases.ResizeEvent` - figure canvas is resized +'scroll_event' :class:`~matplotlib.backend_bases.MouseEvent` - mouse scroll wheel is rolled +'figure_enter_event' :class:`~matplotlib.backend_bases.LocationEvent` - mouse enters a new figure +'figure_leave_event' :class:`~matplotlib.backend_bases.LocationEvent` - mouse leaves a figure +'axes_enter_event' :class:`~matplotlib.backend_bases.LocationEvent` - mouse enters a new axes +'axes_leave_event' :class:`~matplotlib.backend_bases.LocationEvent` - mouse leaves an axes ======================= ====================================================================================== .. _event-attributes: @@ -330,6 +334,66 @@ plt.show() +.. _enter-leave-events: + +Mouse enter and leave +====================== + +If you want to be notified when the mouse enters or leaves a figure or +axes, you can connect to the figure/axes enter/leave events. Here is +a simple example that changes the colors of the axes and figure +background that the mouse is over:: + + """ + Illustrate the figure and axes enter and leave events by changing the + frame colors on enter and leave + """ + import matplotlib.pyplot as plt + + def enter_axes(event): + print 'enter_axes', event.inaxes + event.inaxes.patch.set_facecolor('yellow') + event.canvas.draw() + + def leave_axes(event): + print 'leave_axes', event.inaxes + event.inaxes.patch.set_facecolor('white') + event.canvas.draw() + + def enter_figure(event): + print 'enter_figure', event.canvas.figure + event.canvas.figure.patch.set_facecolor('red') + event.canvas.draw() + + def leave_figure(event): + print 'leave_figure', event.canvas.figure + event.canvas.figure.patch.set_facecolor('grey') + event.canvas.draw() + + fig1 = plt.figure() + fig1.suptitle('mouse hover over figure or axes to trigger events') + ax1 = fig1.add_subplot(211) + ax2 = fig1.add_subplot(212) + + fig1.canvas.mpl_connect('figure_enter_event', enter_figure) + fig1.canvas.mpl_connect('figure_leave_event', leave_figure) + fig1.canvas.mpl_connect('axes_enter_event', enter_axes) + fig1.canvas.mpl_connect('axes_leave_event', leave_axes) + + fig2 = plt.figure() + fig2.suptitle('mouse hover over figure or axes to trigger events') + ax1 = fig2.add_subplot(211) + ax2 = fig2.add_subplot(212) + + fig2.canvas.mpl_connect('figure_enter_event', enter_figure) + fig2.canvas.mpl_connect('figure_leave_event', leave_figure) + fig2.canvas.mpl_connect('axes_enter_event', enter_axes) + fig2.canvas.mpl_connect('axes_leave_event', leave_axes) + + plt.show() + + + .. _object-picking: Object picking Added: trunk/matplotlib/examples/event_handling/figure_axes_enter_leave.py =================================================================== --- trunk/matplotlib/examples/event_handling/figure_axes_enter_leave.py (rev 0) +++ trunk/matplotlib/examples/event_handling/figure_axes_enter_leave.py 2008年11月26日 17:43:09 UTC (rev 6454) @@ -0,0 +1,49 @@ +""" +Illustrate the figure and axes enter and leave events by changing the +frame colors on enter and leave +""" +import matplotlib.pyplot as plt + +def enter_axes(event): + print 'enter_axes', event.inaxes + event.inaxes.patch.set_facecolor('yellow') + event.canvas.draw() + +def leave_axes(event): + print 'leave_axes', event.inaxes + event.inaxes.patch.set_facecolor('white') + event.canvas.draw() + +def enter_figure(event): + print 'enter_figure', event.canvas.figure + event.canvas.figure.patch.set_facecolor('red') + event.canvas.draw() + +def leave_figure(event): + print 'leave_figure', event.canvas.figure + event.canvas.figure.patch.set_facecolor('grey') + event.canvas.draw() + +fig1 = plt.figure() +fig1.suptitle('mouse hover over figure or axes to trigger events') +ax1 = fig1.add_subplot(211) +ax2 = fig1.add_subplot(212) + +fig1.canvas.mpl_connect('figure_enter_event', enter_figure) +fig1.canvas.mpl_connect('figure_leave_event', leave_figure) +fig1.canvas.mpl_connect('axes_enter_event', enter_axes) +fig1.canvas.mpl_connect('axes_leave_event', leave_axes) + +fig2 = plt.figure() +fig2.suptitle('mouse hover over figure or axes to trigger events') +ax1 = fig2.add_subplot(211) +ax2 = fig2.add_subplot(212) + +fig2.canvas.mpl_connect('figure_enter_event', enter_figure) +fig2.canvas.mpl_connect('figure_leave_event', leave_figure) +fig2.canvas.mpl_connect('axes_enter_event', enter_axes) +fig2.canvas.mpl_connect('axes_leave_event', leave_axes) + +plt.show() + + Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backend_bases.py 2008年11月25日 21:43:36 UTC (rev 6453) +++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2008年11月26日 17:43:09 UTC (rev 6454) @@ -743,6 +743,9 @@ xdata = None # x coord of mouse in data coords ydata = None # y coord of mouse in data coords + # the last event that was triggered before this one + _lastevent = None + def __init__(self, name, canvas, x, y,guiEvent=None): """ *x*, *y* in figure coords, 0,0 = bottom, left @@ -751,8 +754,12 @@ self.x = x self.y = y + + if x is None or y is None: # cannot check if event was in axes if no x,y info + self.inaxes = False + self._update_enter_leave() return # Find all axes containing the mouse @@ -760,6 +767,7 @@ if len(axes_list) == 0: # None found self.inaxes = None + self._update_enter_leave() return elif (len(axes_list) > 1): # Overlap, get the highest zorder axCmp = lambda _x,_y: cmp(_x.zorder, _y.zorder) @@ -777,6 +785,36 @@ self.xdata = xdata self.ydata = ydata + self._update_enter_leave() + + def _update_enter_leave(self): + 'process the figure/axes enter leave events' + if LocationEvent._lastevent is not None: + last = LocationEvent._lastevent + if last.canvas!=self.canvas: + # process figure enter/leave event + last.canvas.callbacks.process('figure_leave_event', last) + self.canvas.callbacks.process('figure_enter_event', self) + if last.inaxes!=self.inaxes: + # process axes enter/leave events + if last.inaxes is not None: + last.canvas.callbacks.process('axes_leave_event', last) + if self.inaxes is not None: + self.canvas.callbacks.process('axes_enter_event', self) + + else: + # process a figure enter event + self.canvas.callbacks.process('figure_enter_event', self) + # process an axes enter event if we are over an axes + if self.inaxes is not None: + self.canvas.callbacks.process('axes_enter_event', self) + + + LocationEvent._lastevent = self + + + + class MouseEvent(LocationEvent): """ A mouse event ('button_press_event', 'button_release_event', 'scroll_event', @@ -914,6 +952,12 @@ 'motion_notify_event', 'pick_event', 'idle_event', + 'figure_enter_event', + # todo: we only process this when a mouse enters a different + # figure -- we need to connect to the GUI leavel event + 'figure_leave_event', + 'axes_enter_event', + 'axes_leave_event' ] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6453 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6453&view=rev Author: jdh2358 Date: 2008年11月25日 21:43:36 +0000 (2008年11月25日) Log Message: ----------- added rc param axes.unicode_minus Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/projections/polar.py trunk/matplotlib/lib/matplotlib/rcsetup.py trunk/matplotlib/lib/matplotlib/ticker.py trunk/matplotlib/matplotlibrc.template Added Paths: ----------- trunk/matplotlib/examples/api/unicode_minus.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年11月25日 21:14:13 UTC (rev 6452) +++ trunk/matplotlib/CHANGELOG 2008年11月25日 21:43:36 UTC (rev 6453) @@ -1,3 +1,6 @@ +2008年11月25日 Added rcParam axes.unicode_minus which allows plain hypen + for minus when False - JDH + 2008年11月25日 Added scatterpoints support in Legend. patch by Erik Tollerud - JJL Added: trunk/matplotlib/examples/api/unicode_minus.py =================================================================== --- trunk/matplotlib/examples/api/unicode_minus.py (rev 0) +++ trunk/matplotlib/examples/api/unicode_minus.py 2008年11月25日 21:43:36 UTC (rev 6453) @@ -0,0 +1,18 @@ +""" +You can use the proper typesetting unicode minus (see +http://en.wikipedia.org/wiki/Plus_sign#Plus_sign) or the ASCII hypen +for minus, which some people prefer. The matplotlibrc param +axes.unicode_minus controls the default behavior. + +The default is to use the unicode minus +""" +import numpy as np +import matplotlib +import matplotlib.pyplot as plt + +matplotlib.rcParams['axes.unicode_minus'] = False +fig = plt.figure() +ax = fig.add_subplot(111) +ax.plot(10*np.random.randn(100), 10*np.random.randn(100), 'o') +ax.set_title('Using hypen instead of unicode minus') +plt.show() Modified: trunk/matplotlib/lib/matplotlib/projections/polar.py =================================================================== --- trunk/matplotlib/lib/matplotlib/projections/polar.py 2008年11月25日 21:14:13 UTC (rev 6452) +++ trunk/matplotlib/lib/matplotlib/projections/polar.py 2008年11月25日 21:43:36 UTC (rev 6453) @@ -139,6 +139,11 @@ if rcParams['text.usetex'] and not rcParams['text.latex.unicode']: return r"$%d^\circ$" % ((x / npy.pi) * 180.0) else: + # we use unicode, rather than mathtext with \circ, so + # that it will work correctly with any arbitrary font + # (assuming it has a degree sign), whereas 5ドル\circ$ + # will only work correctly with one of the supported + # math fonts (Computer Modern and STIX) return u"%d\u00b0" % ((x / npy.pi) * 180.0) class RadialLocator(Locator): Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py =================================================================== --- trunk/matplotlib/lib/matplotlib/rcsetup.py 2008年11月25日 21:14:13 UTC (rev 6452) +++ trunk/matplotlib/lib/matplotlib/rcsetup.py 2008年11月25日 21:43:36 UTC (rev 6453) @@ -412,6 +412,7 @@ # use scientific notation if log10 # of the axis range is smaller than the # first or larger than the second + 'axes.unicode_minus' : [True, validate_bool], 'polaraxes.grid' : [True, validate_bool], # display polar grid or not Modified: trunk/matplotlib/lib/matplotlib/ticker.py =================================================================== --- trunk/matplotlib/lib/matplotlib/ticker.py 2008年11月25日 21:14:13 UTC (rev 6452) +++ trunk/matplotlib/lib/matplotlib/ticker.py 2008年11月25日 21:43:36 UTC (rev 6453) @@ -313,7 +313,7 @@ def fix_minus(self, s): 'use a unicode minus rather than hyphen' - if rcParams['text.usetex']: return s + if rcParams['text.usetex'] or not rcParams['axes.unicode_minus']: return s else: return s.replace('-', u'\u2212') def __call__(self, x, pos=None): Modified: trunk/matplotlib/matplotlibrc.template =================================================================== --- trunk/matplotlib/matplotlibrc.template 2008年11月25日 21:14:13 UTC (rev 6452) +++ trunk/matplotlib/matplotlibrc.template 2008年11月25日 21:43:36 UTC (rev 6453) @@ -205,6 +205,8 @@ #axes.formatter.limits : -7, 7 # use scientific notation if log10 # of the axis range is smaller than the # first or larger than the second +#axes.unicode_minus : True # use unicode for the minus symbol + # rather than hypen. See http://en.wikipedia.org/wiki/Plus_sign#Plus_sign #polaraxes.grid : True # display grid on polar axes This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6452 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6452&view=rev Author: jdh2358 Date: 2008年11月25日 21:14:13 +0000 (2008年11月25日) Log Message: ----------- added a chance for polar with usetex to remove unicode symbol Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/projections/polar.py Modified: trunk/matplotlib/lib/matplotlib/projections/polar.py =================================================================== --- trunk/matplotlib/lib/matplotlib/projections/polar.py 2008年11月25日 21:13:09 UTC (rev 6451) +++ trunk/matplotlib/lib/matplotlib/projections/polar.py 2008年11月25日 21:14:13 UTC (rev 6452) @@ -136,7 +136,7 @@ """ def __call__(self, x, pos=None): # \u00b0 : degree symbol - if rcParams['text.usetex']: + if rcParams['text.usetex'] and not rcParams['text.latex.unicode']: return r"$%d^\circ$" % ((x / npy.pi) * 180.0) else: return u"%d\u00b0" % ((x / npy.pi) * 180.0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6451 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6451&view=rev Author: jdh2358 Date: 2008年11月25日 21:13:09 +0000 (2008年11月25日) Log Message: ----------- added a chance for polar with usetex to remove unicode symbol Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/projections/polar.py Modified: trunk/matplotlib/lib/matplotlib/projections/polar.py =================================================================== --- trunk/matplotlib/lib/matplotlib/projections/polar.py 2008年11月25日 19:56:39 UTC (rev 6450) +++ trunk/matplotlib/lib/matplotlib/projections/polar.py 2008年11月25日 21:13:09 UTC (rev 6451) @@ -136,7 +136,10 @@ """ def __call__(self, x, pos=None): # \u00b0 : degree symbol - return u"%d\u00b0" % ((x / npy.pi) * 180.0) + if rcParams['text.usetex']: + return r"$%d^\circ$" % ((x / npy.pi) * 180.0) + else: + return u"%d\u00b0" % ((x / npy.pi) * 180.0) class RadialLocator(Locator): """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6450 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6450&view=rev Author: jdh2358 Date: 2008年11月25日 19:56:39 +0000 (2008年11月25日) Log Message: ----------- removed comment from invalid shared axis merge Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/mlab.py Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2008年11月25日 19:33:05 UTC (rev 6449) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2008年11月25日 19:56:39 UTC (rev 6450) @@ -2460,8 +2460,10 @@ # Get header and remove invalid characters needheader = names is None + if needheader: for row in reader: + #print 'csv2rec', row if len(row) and row[0].startswith(comments): continue headers = row This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6449 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6449&view=rev Author: mdboom Date: 2008年11月25日 19:33:05 +0000 (2008年11月25日) Log Message: ----------- Remove code that was inadvertently merged from branch. 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年11月25日 18:56:57 UTC (rev 6448) +++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2008年11月25日 19:33:05 UTC (rev 6449) @@ -1883,14 +1883,7 @@ for cur_xypress in self._xypress: x, y = event.x, event.y lastx, lasty, a, ind, lim, trans = cur_xypress - # JDH: I don't know why this is here but I expect to be - # able to zoomo on any axis that is shared. This was - # breaking zoom-to-rect on sharex_axis_demo if the zoom - # happened in ax2 or ax3 so i am replacing the continue - # with a pass until this is sorted out - if a._sharex or a._sharey: - #continue - pass + # ignore singular clicks - 5 pixels is a threshold if abs(x-lastx)<5 or abs(y-lasty)<5: self._xypress = None This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6448 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6448&view=rev Author: leejjoon Date: 2008年11月25日 18:56:57 +0000 (2008年11月25日) Log Message: ----------- scatterpoints support in Legend. patch by Erik Tollerud Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/legend.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年11月25日 18:28:13 UTC (rev 6447) +++ trunk/matplotlib/CHANGELOG 2008年11月25日 18:56:57 UTC (rev 6448) @@ -1,3 +1,6 @@ +2008年11月25日 Added scatterpoints support in Legend. patch by Erik + Tollerud - JJL + 2008年11月24日 Fix crash in log ticking. - MGD 2008年11月20日 Added static helper method BrokenHBarCollection.span_where Modified: trunk/matplotlib/lib/matplotlib/legend.py =================================================================== --- trunk/matplotlib/lib/matplotlib/legend.py 2008年11月25日 18:28:13 UTC (rev 6447) +++ trunk/matplotlib/lib/matplotlib/legend.py 2008年11月25日 18:56:57 UTC (rev 6448) @@ -83,6 +83,7 @@ def __init__(self, parent, handles, labels, loc = None, numpoints = None, # the number of points in the legend line + scatterpoints = 3, # TODO: may be an rcParam prop = None, pad = None, # the fractional whitespace inside the legend border borderpad = None, @@ -101,6 +102,7 @@ labels # a list of strings to label the legend loc # a location code numpoints = 4 # the number of points in the legend line + scatterpoints = 3 # the number of points for the scatterplot legend prop = FontProperties(size='smaller') # the font property pad = 0.2 # the fractional whitespace inside the legend border markerscale = 0.6 # the relative size of legend markers vs. original @@ -118,10 +120,10 @@ Artist.__init__(self) - proplist=[numpoints, pad, borderpad, markerscale, labelsep, + proplist=[numpoints, scatterpoints, pad, borderpad, markerscale, labelsep, handlelen, handletextsep, axespad, shadow] - propnames=['numpoints', 'pad', 'borderpad', 'markerscale', 'labelsep', - 'handlelen', 'handletextsep', 'axespad', 'shadow'] + propnames=['numpoints','scatterpoints', 'pad', 'borderpad', 'markerscale', + 'labelsep', 'handlelen', 'handletextsep', 'axespad', 'shadow'] for name, value in safezip(propnames,proplist): if value is None: value=rcParams["legend."+name] @@ -130,7 +132,9 @@ warnings.warn("Use 'borderpad' instead of 'pad'.", DeprecationWarning) # 2008年10月04日 if self.numpoints <= 0: - raise ValueError("numpoints must be >= 0; it was %d"% numpoints) + raise ValueError("numpoints must be > 0; it was %d"% numpoints) + if self.scatterpoints <= 0: + raise ValueError("scatterpoints must be > 0; it was %d"% numpoints) if prop is None: self.prop=FontProperties(size=rcParams["legend.fontsize"]) else: @@ -142,8 +146,8 @@ self._scatteryoffsets = np.array([4./8., 5./8., 3./8.]) else: self._scatteryoffsets = np.asarray(scatteryoffsets) - reps = int(self.numpoints / len(self._scatteryoffsets)) + 1 - self._scatteryoffsets = np.tile(self._scatteryoffsets, reps)[:self.numpoints] + reps = int(self.scatterpoints / len(self._scatteryoffsets)) + 1 + self._scatteryoffsets = np.tile(self._scatteryoffsets, reps)[:self.scatterpoints] if isinstance(parent,Axes): self.isaxes = True @@ -261,10 +265,14 @@ # centered marker proxy for handle, label in safezip(handles, texts): - if self.numpoints > 1: - xdata = np.linspace(left, left + self.handlelen, self.numpoints) + if isinstance(handle, RegularPolyCollection): + npoints = self.scatterpoints + else: + npoints = self.numpoints + if npoints > 1: + xdata = np.linspace(left, left + self.handlelen, npoints) xdata_marker = xdata - elif self.numpoints == 1: + elif npoints == 1: xdata = np.linspace(left, left + self.handlelen, 2) xdata_marker = [left + 0.5*self.handlelen] @@ -326,8 +334,11 @@ # we may need to scale these sizes by "markerscale" # attribute. But other handle types does not seem # to care about this attribute and it is currently ignored. - sizes = [.5*(size_max+size_min), size_max, - size_min] + if self.scatterpoints < 4: + sizes = [.5*(size_max+size_min), size_max, + size_min] + else: + sizes = size_max*np.linspace(0,1,self.scatterpoints)+size_min p = type(handle)(handle.get_numsides(), rotation=handle.get_rotation(), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6447 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6447&view=rev Author: jdh2358 Date: 2008年11月25日 18:28:13 +0000 (2008年11月25日) Log Message: ----------- fixed a zoom bug in sharex axis 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年11月25日 15:23:28 UTC (rev 6446) +++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2008年11月25日 18:28:13 UTC (rev 6447) @@ -269,7 +269,7 @@ gc.set_alpha(rgbFace[-1]) rgbFace = rgbFace[:3] gc.set_antialiased(antialiaseds[i % Naa]) - + if Nurls: gc.set_url(urls[i % Nurls]) @@ -527,7 +527,7 @@ matlab format string, a html hex color string, or a rgb tuple """ return self._rgb - + def get_url(self): """ returns a url if one is set, None otherwise @@ -633,7 +633,7 @@ raise ValueError('Unrecognized linestyle: %s' % style) self._linestyle = style self.set_dashes(offset, dashes) - + def set_url(self, url): """ Sets the url for links in compatible backends @@ -1531,7 +1531,7 @@ if event.key == 'f': self.full_screen_toggle() - + # *h*ome or *r*eset mnemonic elif event.key == 'h' or event.key == 'r' or event.key == "home": self.canvas.toolbar.home() @@ -1883,8 +1883,14 @@ for cur_xypress in self._xypress: x, y = event.x, event.y lastx, lasty, a, ind, lim, trans = cur_xypress + # JDH: I don't know why this is here but I expect to be + # able to zoomo on any axis that is shared. This was + # breaking zoom-to-rect on sharex_axis_demo if the zoom + # happened in ax2 or ax3 so i am replacing the continue + # with a pass until this is sorted out if a._sharex or a._sharey: - continue + #continue + pass # ignore singular clicks - 5 pixels is a threshold if abs(x-lastx)<5 or abs(y-lasty)<5: self._xypress = None This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6446 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6446&view=rev Author: mdboom Date: 2008年11月25日 15:23:28 +0000 (2008年11月25日) Log Message: ----------- Fix mathtext (bug has existed since r6400 11/12/2008) Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/font_manager.py Modified: trunk/matplotlib/lib/matplotlib/font_manager.py =================================================================== --- trunk/matplotlib/lib/matplotlib/font_manager.py 2008年11月25日 04:03:59 UTC (rev 6445) +++ trunk/matplotlib/lib/matplotlib/font_manager.py 2008年11月25日 15:23:28 UTC (rev 6446) @@ -592,7 +592,7 @@ verbose.report("Cannot handle unicode filenames") #print >> sys.stderr, 'Bad file is', fpath continue - try: prop = ttfFontProperty(fpath, font) + try: prop = ttfFontProperty(font) except: continue fontlist.append(prop) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6445 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6445&view=rev Author: jdh2358 Date: 2008年11月25日 04:03:59 +0000 (2008年11月25日) Log Message: ----------- point to the right url for the rc file Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/doc/_templates/gallery.html trunk/matplotlib/doc/_templates/indexsidebar.html trunk/matplotlib/doc/make.py trunk/matplotlib/doc/users/customizing.rst trunk/matplotlib/lib/matplotlib/__init__.py trunk/matplotlib/matplotlibrc.template Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年11月24日 20:18:38 UTC (rev 6444) +++ trunk/matplotlib/CHANGELOG 2008年11月25日 04:03:59 UTC (rev 6445) @@ -1,9 +1,8 @@ 2008年11月24日 Fix crash in log ticking. - MGD -2008年11月20日 Added some static helper methods - BrokenHBarCollection.span_masked and - PolyCollection.fill_between_where for visualizing logical - regions. See examples/api/fill_where_demo.py - JDH +2008年11月20日 Added static helper method BrokenHBarCollection.span_where + and Axes/pyplot method fill_between. See + examples/pylab/fill_between.py - JDH 2008年11月12日 Add x_isdata and y_isdata attributes to Artist instances, and use them to determine whether either or both Modified: trunk/matplotlib/doc/_templates/gallery.html =================================================================== --- trunk/matplotlib/doc/_templates/gallery.html 2008年11月24日 20:18:38 UTC (rev 6444) +++ trunk/matplotlib/doc/_templates/gallery.html 2008年11月25日 04:03:59 UTC (rev 6445) @@ -49,6 +49,8 @@ <a href="examples/api/scatter_piecharts.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/scatter_piecharts.png" border="0" alt="scatter_piecharts"/></a> +<a href="examples/api/span_regions.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/span_regions.png" border="0" alt="span_regions"/></a> + <a href="examples/api/two_scales.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/two_scales.png" border="0" alt="two_scales"/></a> <a href="examples/api/watermark_image.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/watermark_image.png" border="0" alt="watermark_image"/></a> @@ -157,6 +159,8 @@ <a href="examples/pylab_examples/csd_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/csd_demo.png" border="0" alt="csd_demo"/></a> +<a href="examples/pylab_examples/custom_cmap.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/custom_cmap.png" border="0" alt="custom_cmap"/></a> + <a href="examples/pylab_examples/custom_figure_class.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/custom_figure_class.png" border="0" alt="custom_figure_class"/></a> <a href="examples/pylab_examples/custom_ticker1.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/custom_ticker1.png" border="0" alt="custom_ticker1"/></a> @@ -223,9 +227,9 @@ <a href="examples/pylab_examples/figure_title.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/figure_title.png" border="0" alt="figure_title"/></a> -<a href="examples/pylab_examples/fill_between.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_between.png" border="0" alt="fill_between"/></a> +<a href="examples/pylab_examples/fill_between.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_between_00.png" border="0" alt="fill_between"/></a> -<a href="examples/pylab_examples/fill_between_posneg.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_between_posneg.png" border="0" alt="fill_between_posneg"/></a> +<a href="examples/pylab_examples/fill_between.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_between_01.png" border="0" alt="fill_between"/></a> <a href="examples/pylab_examples/fill_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_demo.png" border="0" alt="fill_demo"/></a> @@ -419,6 +423,8 @@ <a href="examples/pylab_examples/psd_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/psd_demo.png" border="0" alt="psd_demo"/></a> +<a href="examples/pylab_examples/psd_demo2.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/psd_demo2.png" border="0" alt="psd_demo2"/></a> + <a href="examples/pylab_examples/pythonic_matplotlib.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/pythonic_matplotlib.png" border="0" alt="pythonic_matplotlib"/></a> <a href="examples/pylab_examples/quadmesh_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/quadmesh_demo.png" border="0" alt="quadmesh_demo"/></a> Modified: trunk/matplotlib/doc/_templates/indexsidebar.html =================================================================== --- trunk/matplotlib/doc/_templates/indexsidebar.html 2008年11月24日 20:18:38 UTC (rev 6444) +++ trunk/matplotlib/doc/_templates/indexsidebar.html 2008年11月25日 04:03:59 UTC (rev 6445) @@ -33,7 +33,7 @@ <p>For details on what's new, see the detailed <a href="{{ pathto('_static/CHANGELOG', 1) }}">changelog</a>. Anything that could -required changes to your existing codes is logged in the <a href="{{ +require changes to your existing codes is logged in the <a href="{{ pathto('api/api_changes.html', 1) }}">api changes</a> file.</p> <h3>Other stuff</h3> Modified: trunk/matplotlib/doc/make.py =================================================================== --- trunk/matplotlib/doc/make.py 2008年11月24日 20:18:38 UTC (rev 6444) +++ trunk/matplotlib/doc/make.py 2008年11月25日 04:03:59 UTC (rev 6445) @@ -17,9 +17,6 @@ def sf(): 'push a copy to the sf site' shutil.copy('../CHANGELOG', 'build/html/_static/CHANGELOG') - shutil.copy('../API_CHANGES', 'build/html/_static/API_CHANGES') - shutil.copy('../MIGRATION.txt', 'build/html/_static/MIGRATION.txt') - os.system('cd build/html; rsync -avz . jdh2358,mat...@we...:/home/groups/m/ma/matplotlib/htdocs/ -essh --cvs-exclude') def sfpdf(): @@ -44,6 +41,7 @@ check_build() if not os.path.exists('examples/index.rst'): examples() + shutil.copy('mpl_data/matplotlibrc', '_static/matplotlibrc') #figs() if os.system('sphinx-build -b html -d build/doctrees . build/html'): raise SystemExit("Building HTML failed.") Modified: trunk/matplotlib/doc/users/customizing.rst =================================================================== --- trunk/matplotlib/doc/users/customizing.rst 2008年11月24日 20:18:38 UTC (rev 6444) +++ trunk/matplotlib/doc/users/customizing.rst 2008年11月25日 04:03:59 UTC (rev 6445) @@ -61,6 +61,10 @@ .. _matplotlibrc-sample: A sample matplotlibrc file --------------------------- +-------------------------------------------------------------------- +.. htmlonly:: + + `(download) <../_static/matplotlibrc>`__ + .. literalinclude:: ../mpl_data/matplotlibrc Modified: trunk/matplotlib/lib/matplotlib/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/__init__.py 2008年11月24日 20:18:38 UTC (rev 6444) +++ trunk/matplotlib/lib/matplotlib/__init__.py 2008年11月25日 04:03:59 UTC (rev 6445) @@ -666,7 +666,7 @@ Bad key "%s" on line %d in %s. You probably need to get an updated matplotlibrc file from -http://matplotlib.sf.net/matplotlibrc or from the matplotlib source +http://matplotlib.sf.net/_static/matplotlibrc or from the matplotlib source distribution""" % (key, cnt, fname) if ret['datapath'] is None: Modified: trunk/matplotlib/matplotlibrc.template =================================================================== --- trunk/matplotlib/matplotlibrc.template 2008年11月24日 20:18:38 UTC (rev 6444) +++ trunk/matplotlib/matplotlibrc.template 2008年11月25日 04:03:59 UTC (rev 6445) @@ -10,13 +10,16 @@ # (win32 systems). # # This file is best viewed in a editor which supports python mode -# syntax highlighting # Blank lines, or lines starting with a comment +# syntax highlighting. Blank lines, or lines starting with a comment # symbol, are ignored, as are trailing comments. Other lines must -# have the format # key : val # optional comment # Colors: for the -# color values below, you can either use - a matplotlib color string, -# such as r, k, or b - an rgb tuple, such as (1.0, 0.5, 0.0) - a hex -# string, such as ff00ff or #ff00ff - a scalar grayscale intensity -# such as 0.75 - a legal html color name, eg red, blue, darkslategray +# have the format +# key : val # optional comment +# +# Colors: for the color values below, you can either use - a +# matplotlib color string, such as r, k, or b - an rgb tuple, such as +# (1.0, 0.5, 0.0) - a hex string, such as ff00ff or #ff00ff - a scalar +# grayscale intensity such as 0.75 - a legal html color name, eg red, +# blue, darkslategray #### CONFIGURATION BEGINS HERE This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6444 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6444&view=rev Author: mdboom Date: 2008年11月24日 20:18:38 +0000 (2008年11月24日) Log Message: ----------- Remove conflict markers from CHANGELOG. Modified Paths: -------------- trunk/matplotlib/CHANGELOG Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年11月24日 20:14:21 UTC (rev 6443) +++ trunk/matplotlib/CHANGELOG 2008年11月24日 20:18:38 UTC (rev 6444) @@ -29,6 +29,8 @@ 2008年11月09日 Fix a possible EINTR problem in dviread, which might help when saving pdf files from the qt backend. - JKS +2008年11月05日 Fix bug with zoom to rectangle and twin axes - MGD + 2008年10月24日 Added Jae Joon's fancy arrow, box and annotation enhancements -- see examples/pylab_examples/annotation_demo2.py @@ -53,10 +55,6 @@ 2008年10月08日 Add path simplification support to paths with gaps. - EF -======= -2008年11月05日 Fix bug with zoom to rectangle and twin axes - MGD - ->>>>>>> .merge-right.r6428 2008年10月05日 Fix problem with AFM files that don't specify the font's full name or family name. - JKS @@ -100,9 +98,6 @@ 2008年09月10日 Add "filled" kwarg to Path.intersects_path and Path.intersects_bbox. - MGD -======= -2008年09月11日 Fix use of backticks in PS - MGD - 2008年09月07日 Changed full arrows slightly to avoid an xpdf rendering problem reported by Friedrich Hagedorn. - JKS This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6443 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6443&view=rev Author: mdboom Date: 2008年11月24日 20:14:21 +0000 (2008年11月24日) Log Message: ----------- [ 2314869 ] Log base-2 axes fail with certain axis limits Modified Paths: -------------- trunk/matplotlib/CHANGELOG Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年11月24日 20:12:55 UTC (rev 6442) +++ trunk/matplotlib/CHANGELOG 2008年11月24日 20:14:21 UTC (rev 6443) @@ -103,7 +103,6 @@ ======= 2008年09月11日 Fix use of backticks in PS - MGD ->>>>>>> .merge-right.r6086 2008年09月07日 Changed full arrows slightly to avoid an xpdf rendering problem reported by Friedrich Hagedorn. - JKS This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6442 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6442&view=rev Author: mdboom Date: 2008年11月24日 20:12:55 +0000 (2008年11月24日) Log Message: ----------- [ 2314869 ] Log base-2 axes fail with certain axis limits Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/ticker.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年11月24日 03:53:14 UTC (rev 6441) +++ trunk/matplotlib/CHANGELOG 2008年11月24日 20:12:55 UTC (rev 6442) @@ -1,3 +1,5 @@ +2008年11月24日 Fix crash in log ticking. - MGD + 2008年11月20日 Added some static helper methods BrokenHBarCollection.span_masked and PolyCollection.fill_between_where for visualizing logical Modified: trunk/matplotlib/lib/matplotlib/ticker.py =================================================================== --- trunk/matplotlib/lib/matplotlib/ticker.py 2008年11月24日 03:53:14 UTC (rev 6441) +++ trunk/matplotlib/lib/matplotlib/ticker.py 2008年11月24日 20:12:55 UTC (rev 6442) @@ -1037,7 +1037,7 @@ decades = np.arange(math.floor(vmin), math.ceil(vmax)+stride, stride) - if len(subs) > 1 or subs[0] != 1.0: + if len(subs) > 1 or (len(subs == 1) and subs[0] != 1.0): ticklocs = [] for decadeStart in b**decades: ticklocs.extend( subs*decadeStart ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6441 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6441&view=rev Author: jdh2358 Date: 2008年11月24日 03:53:14 +0000 (2008年11月24日) Log Message: ----------- fixed a small bug in fill_between Modified Paths: -------------- trunk/matplotlib/examples/pylab_examples/fill_between.py Modified: trunk/matplotlib/examples/pylab_examples/fill_between.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/fill_between.py 2008年11月23日 20:15:36 UTC (rev 6440) +++ trunk/matplotlib/examples/pylab_examples/fill_between.py 2008年11月24日 03:53:14 UTC (rev 6441) @@ -28,7 +28,7 @@ # because of edge effects over multiple contiguous regions. fig = figure() ax = fig.add_subplot(111) -ax1.plot(x, y1, x, y2, color='black') +ax.plot(x, y1, x, y2, color='black') ax.fill_between(x, y1, y2, where=y2>y1, facecolor='green') ax.fill_between(x, y1, y2, where=y2<=y1, facecolor='red') ax.set_title('fill between where') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6440 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6440&view=rev Author: jdh2358 Date: 2008年11月23日 20:15:36 +0000 (2008年11月23日) Log Message: ----------- fixed datalim update for fill_between Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年11月23日 20:09:08 UTC (rev 6439) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年11月23日 20:15:36 UTC (rev 6440) @@ -5559,8 +5559,14 @@ collection = mcoll.PolyCollection(polys, **kwargs) - self.update_datalim_numerix(x[where], y1[where]) - self.update_datalim_numerix(x[where], y2[where]) + # now update the datalim and autoscale + XY1 = np.array([x[where], y1[where]]).T + XY2 = np.array([x[where], y2[where]]).T + self.dataLim.update_from_data_xy(XY1, self.ignore_existing_data_limits, + updatex=True, updatey=True) + + self.dataLim.update_from_data_xy(XY2, self.ignore_existing_data_limits, + updatex=False, updatey=True) self.add_collection(collection) self.autoscale_view() return collection This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6439 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6439&view=rev Author: jdh2358 Date: 2008年11月23日 20:09:08 +0000 (2008年11月23日) Log Message: ----------- removed deprecated example Modified Paths: -------------- trunk/matplotlib/examples/pylab_examples/fill_between.py Modified: trunk/matplotlib/examples/pylab_examples/fill_between.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/fill_between.py 2008年11月23日 19:57:18 UTC (rev 6438) +++ trunk/matplotlib/examples/pylab_examples/fill_between.py 2008年11月23日 20:09:08 UTC (rev 6439) @@ -22,6 +22,10 @@ ax3.set_ylabel('between y1 and y2') ax3.set_xlabel('x') +# now fill between y1 and y2 where a logical condition is met. Note +# this is different than calling +# fill_between(x[where], y1[where],y2[where] +# because of edge effects over multiple contiguous regions. fig = figure() ax = fig.add_subplot(111) ax1.plot(x, y1, x, y2, color='black') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6438 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6438&view=rev Author: jdh2358 Date: 2008年11月23日 19:57:18 +0000 (2008年11月23日) Log Message: ----------- removed deprecated example Removed Paths: ------------- trunk/matplotlib/examples/api/fill_where_demo.py Deleted: trunk/matplotlib/examples/api/fill_where_demo.py =================================================================== --- trunk/matplotlib/examples/api/fill_where_demo.py 2008年11月23日 19:56:37 UTC (rev 6437) +++ trunk/matplotlib/examples/api/fill_where_demo.py 2008年11月23日 19:57:18 UTC (rev 6438) @@ -1,53 +0,0 @@ -""" -Illustrate some helper functions for shading regions where a logical -mask is True - -See :meth:`matplotlib.collections.PolyCollection.fill_between_where` -and :meth:`matplotlib.collections.BrokenBarHCollection.span_where` -""" -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.collections as collections - - -t = np.arange(0.0, 2, 0.01) -s1 = np.sin(2*np.pi*t) -s2 = 1.2*np.sin(4*np.pi*t) - -fig = plt.figure() -ax = fig.add_subplot(111) -ax.set_title('using fill_between_where') -ax.plot(t, s1, t, s2, color='black') -ax.axhline(0, color='black', lw=2) - -collection = collections.PolyCollection.fill_between_where( - t, s1, s2, where=s1>=s2, color='green', alpha=0.5) -ax.add_collection(collection) - -collection = collections.PolyCollection.fill_between_where( - t, s1, s2, where=s1<=s2, color='red', alpha=0.5) -ax.add_collection(collection) - - -fig = plt.figure() -ax = fig.add_subplot(111) -ax.set_title('using span_where') -ax.plot(t, s1, , color='black') -ax.axhline(0, color='black', lw=2) - -collection = collections.BrokenBarHCollection.span_where( - t, ymin=0, ymax=1, where=s1>0, facecolor='green', alpha=0.5) -ax.add_collection(collection) - -collection = collections.BrokenBarHCollection.span_where( - t, ymin=-1, ymax=0, where=s1<0, facecolor='red', alpha=0.5) -ax.add_collection(collection) - - - -plt.show() - - - - - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6437 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6437&view=rev Author: jdh2358 Date: 2008年11月23日 19:56:37 +0000 (2008年11月23日) Log Message: ----------- moved fill_between to axes/pyplot method Modified Paths: -------------- trunk/matplotlib/boilerplate.py trunk/matplotlib/doc/_templates/index.html trunk/matplotlib/examples/api/fill_where_demo.py trunk/matplotlib/examples/pylab_examples/fill_between.py trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/collections.py trunk/matplotlib/lib/matplotlib/pyplot.py Added Paths: ----------- trunk/matplotlib/examples/api/span_regions.py Modified: trunk/matplotlib/boilerplate.py =================================================================== --- trunk/matplotlib/boilerplate.py 2008年11月23日 19:18:24 UTC (rev 6436) +++ trunk/matplotlib/boilerplate.py 2008年11月23日 19:56:37 UTC (rev 6437) @@ -64,6 +64,7 @@ 'csd', 'errorbar', 'fill', + 'fill_between', 'hexbin', 'hist', 'hlines', Modified: trunk/matplotlib/doc/_templates/index.html =================================================================== --- trunk/matplotlib/doc/_templates/index.html 2008年11月23日 19:18:24 UTC (rev 6436) +++ trunk/matplotlib/doc/_templates/index.html 2008年11月23日 19:56:37 UTC (rev 6437) @@ -409,8 +409,21 @@ </td> </tr> + <tr> <th align="left"> + <a href="api/pyplot_api.html#matplotlib.pyplot.fill_between">fill_between</a> + + </th> + + <td align="left"> + make filled polygons between two curves + </td> + + </tr> + + <tr> + <th align="left"> <a href="api/pyplot_api.html#matplotlib.pyplot.findobj">findobj</a> </th> Modified: trunk/matplotlib/examples/api/fill_where_demo.py =================================================================== --- trunk/matplotlib/examples/api/fill_where_demo.py 2008年11月23日 19:18:24 UTC (rev 6436) +++ trunk/matplotlib/examples/api/fill_where_demo.py 2008年11月23日 19:56:37 UTC (rev 6437) @@ -17,7 +17,7 @@ fig = plt.figure() ax = fig.add_subplot(111) ax.set_title('using fill_between_where') -ax.plot(t, s1, t, s2) +ax.plot(t, s1, t, s2, color='black') ax.axhline(0, color='black', lw=2) collection = collections.PolyCollection.fill_between_where( @@ -32,7 +32,7 @@ fig = plt.figure() ax = fig.add_subplot(111) ax.set_title('using span_where') -ax.plot(t, s1, '-') +ax.plot(t, s1, , color='black') ax.axhline(0, color='black', lw=2) collection = collections.BrokenBarHCollection.span_where( Added: trunk/matplotlib/examples/api/span_regions.py =================================================================== --- trunk/matplotlib/examples/api/span_regions.py (rev 0) +++ trunk/matplotlib/examples/api/span_regions.py 2008年11月23日 19:56:37 UTC (rev 6437) @@ -0,0 +1,38 @@ +""" +Illustrate some helper functions for shading regions where a logical +mask is True + +See :meth:`matplotlib.collections.BrokenBarHCollection.span_where` +""" +import numpy as np +import matplotlib.pyplot as plt +import matplotlib.collections as collections + + +t = np.arange(0.0, 2, 0.01) +s1 = np.sin(2*np.pi*t) +s2 = 1.2*np.sin(4*np.pi*t) + + +fig = plt.figure() +ax = fig.add_subplot(111) +ax.set_title('using span_where') +ax.plot(t, s1, color='black') +ax.axhline(0, color='black', lw=2) + +collection = collections.BrokenBarHCollection.span_where( + t, ymin=0, ymax=1, where=s1>0, facecolor='green', alpha=0.5) +ax.add_collection(collection) + +collection = collections.BrokenBarHCollection.span_where( + t, ymin=-1, ymax=0, where=s1<0, facecolor='red', alpha=0.5) +ax.add_collection(collection) + + + +plt.show() + + + + + Modified: trunk/matplotlib/examples/pylab_examples/fill_between.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/fill_between.py 2008年11月23日 19:18:24 UTC (rev 6436) +++ trunk/matplotlib/examples/pylab_examples/fill_between.py 2008年11月23日 19:56:37 UTC (rev 6437) @@ -3,27 +3,31 @@ from pylab import figure, show import numpy as np -x = np.arange(0, 2, 0.01) +x = np.arange(0.0, 2, 0.01) y1 = np.sin(2*np.pi*x) -y2 = np.sin(4*np.pi*x) + 2 +y2 = 1.2*np.sin(4*np.pi*x) fig = figure() -ax = fig.add_subplot(311) -ax2 = fig.add_subplot(312) -ax3 = fig.add_subplot(313) +ax1 = fig.add_subplot(311) +ax2 = fig.add_subplot(312, sharex=ax1) +ax3 = fig.add_subplot(313, sharex=ax1) +ax1.fill_between(x, 0, y1) +ax1.set_ylabel('between y1 and 0') -xs, ys = mlab.poly_between(x, 0, y1) -ax.fill(xs, ys) -ax.set_ylabel('between y1 and 0') - -xs, ys = mlab.poly_between(x, y1, 1) -ax2.fill(xs, ys) +ax2.fill_between(x, y1, 1) ax2.set_ylabel('between y1 and 1') -xs, ys = mlab.poly_between(x, y1, y2) -ax3.fill(xs, ys) +ax3.fill_between(x, y1, y2) ax3.set_ylabel('between y1 and y2') ax3.set_xlabel('x') + +fig = figure() +ax = fig.add_subplot(111) +ax1.plot(x, y1, x, y2, color='black') +ax.fill_between(x, y1, y2, where=y2>y1, facecolor='green') +ax.fill_between(x, y1, y2, where=y2<=y1, facecolor='red') +ax.set_title('fill between where') + show() Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年11月23日 19:18:24 UTC (rev 6436) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年11月23日 19:56:37 UTC (rev 6437) @@ -1302,6 +1302,7 @@ if autolim: if collection._paths and len(collection._paths): self.update_datalim(collection.get_datalim(self.transData)) + collection._remove_method = lambda h: self.collections.remove(h) def add_line(self, line): @@ -5456,12 +5457,8 @@ supports are supported by the fill format string. If you would like to fill below a curve, eg. shade a region - between 0 and *y* along *x*, use - :func:`~matplotlib.pylab.poly_between`, eg.:: + between 0 and *y* along *x*, use :meth:`fill_between` - xs, ys = poly_between(x, 0, y) - axes.fill(xs, ys, facecolor='red', alpha=0.5) - The *closed* kwarg will close the polygon when *True* (default). kwargs control the Polygon properties: @@ -5472,9 +5469,6 @@ .. plot:: mpl_examples/pylab_examples/fill_demo.py - .. seealso:: - :file:`examples/pylab_examples/fill_between.py`: - For more examples. """ if not self._hold: self.cla() @@ -5486,6 +5480,92 @@ return patches fill.__doc__ = cbook.dedent(fill.__doc__) % martist.kwdocd + def fill_between(self, x, y1, y2=0, where=None, **kwargs): + """ + call signature:: + + fill_between(x, y1, y2=0, where=None, **kwargs) + + Create a :class:`~matplotlib.collectionsPolyCollection` + filling the regions between *y1* and *y2* where + ``where==True`` + + *x* + an N length np array of the x data + + *y1* + an N length scalar or np array of the x data + + *y2* + an N length scalar or np array of the x data + + *where* + if None, default to fill between everywhere. If not None, + it is a a N length numpy boolean array and the fill will + only happen over the regions where ``where==True`` + + *kwargs* + keyword args passed on to the :class:`PolyCollection` + + .. seealso:: + :file:`examples/pylab_examples/fill_between.py`: + For more examples. + + kwargs control the Polygon properties: + + %(PolyCollection)s + + """ + x = np.asarray(x) + if not cbook.iterable(y1): + y1 = np.ones_like(x)*y1 + + if not cbook.iterable(y2): + y2 = np.ones_like(x)*y2 + + if where is None: + where = np.ones(len(x), np.bool) + + y1 = np.asarray(y1) + y2 = np.asarray(y2) + where = np.asarray(where) + assert( (len(x)==len(y1)) and (len(x)==len(y2)) and len(x)==len(where)) + + polys = [] + for ind0, ind1 in mlab.contiguous_regions(where): + theseverts = [] + xslice = x[ind0:ind1] + y1slice = y1[ind0:ind1] + y2slice = y2[ind0:ind1] + + if not len(xslice): + continue + + N = len(xslice) + X = np.zeros((2*N+2, 2), np.float) + + # the purpose of the next two lines is for when y2 is a + # scalar like 0 and we want the fill to go all the way + # down to 0 even if none of the y1 sample points do + X[0] = xslice[0], y2slice[0] + X[N+1] = xslice[-1], y2slice[-1] + + X[1:N+1,0] = xslice + X[1:N+1,1] = y1slice + X[N+2:,0] = xslice[::-1] + X[N+2:,1] = y2slice[::-1] + + polys.append(X) + + collection = mcoll.PolyCollection(polys, **kwargs) + + self.update_datalim_numerix(x[where], y1[where]) + self.update_datalim_numerix(x[where], y2[where]) + self.add_collection(collection) + self.autoscale_view() + return collection + fill_between.__doc__ = cbook.dedent(fill_between.__doc__) % martist.kwdocd + #### plotting z(x,y): imshow, pcolor and relatives, contour def imshow(self, X, cmap=None, norm=None, aspect=None, Modified: trunk/matplotlib/lib/matplotlib/collections.py =================================================================== --- trunk/matplotlib/lib/matplotlib/collections.py 2008年11月23日 19:18:24 UTC (rev 6436) +++ trunk/matplotlib/lib/matplotlib/collections.py 2008年11月23日 19:56:37 UTC (rev 6437) @@ -673,66 +673,6 @@ return Collection.draw(self, renderer) - @staticmethod - def fill_between_where(x, y1, y2, where, **kwargs): - """ - Create a :class:`PolyCollection` filling the regions between *y* - and *yboundary7* where ``where==True`` - - - *x* - an N length np array of the x data - - *y1* - an N length scalar or np array of the x data - - *y2* - an N length scalar or np array of the x data - - *where* - an N length numpy boolean array - - *kwargs* - keyword args passed on to the :class:`PolyCollection` - - """ - if not cbook.iterable(y1): - y1 = np.ones_like(x)*y1 - - if not cbook.iterable(y2): - y2 = np.ones_like(x)*y2 - - assert( (len(x)==len(y1)) and (len(x)==len(y2)) ) - - polys = [] - for ind0, ind1 in mlab.contiguous_regions(where): - theseverts = [] - xslice = x[ind0:ind1] - y1slice = y1[ind0:ind1] - y2slice = y2[ind0:ind1] - - if not len(xslice): - continue - - N = len(xslice) - X = np.zeros((2*N+2, 2), np.float) - - # the purpose of the next two lines is for when y2 is a - # scalar like 0 and we want the fill to go all the way - # down to 0 even if none of the y1 sample points do - X[0] = xslice[0], y2slice[0] - X[N+1] = xslice[-1], y2slice[-1] - - X[1:N+1,0] = xslice - X[1:N+1,1] = y1slice - X[N+2:,0] = xslice[::-1] - X[N+2:,1] = y2slice[::-1] - - polys.append(X) - - collection = PolyCollection(polys, **kwargs) - return collection - class BrokenBarHCollection(PolyCollection): """ A collection of horizontal bars spanning *yrange* with a sequence of Modified: trunk/matplotlib/lib/matplotlib/pyplot.py =================================================================== --- trunk/matplotlib/lib/matplotlib/pyplot.py 2008年11月23日 19:18:24 UTC (rev 6436) +++ trunk/matplotlib/lib/matplotlib/pyplot.py 2008年11月23日 19:56:37 UTC (rev 6437) @@ -1120,61 +1120,62 @@ """ Plotting commands - ========= ================================================= - Command Description - ========= ================================================= - axes Create a new axes - axis Set or return the current axis limits - bar make a bar chart - boxplot make a box and whiskers chart - cla clear current axes - clabel label a contour plot - clf clear a figure window - close close a figure window - colorbar add a colorbar to the current figure - cohere make a plot of coherence - contour make a contour plot - contourf make a filled contour plot - csd make a plot of cross spectral density - draw force a redraw of the current figure - errorbar make an errorbar graph - figlegend add a legend to the figure - figimage add an image to the figure, w/o resampling - figtext add text in figure coords - figure create or change active figure - fill make filled polygons - gca return the current axes - gcf return the current figure - gci get the current image, or None - getp get a handle graphics property - hist make a histogram - hold set the hold state on current axes - legend add a legend to the axes - loglog a log log plot - imread load image file into array - imshow plot image data - matshow display a matrix in a new figure preserving aspect - pcolor make a pseudocolor plot - plot make a line plot - plotfile plot data from a flat file - psd make a plot of power spectral density - quiver make a direction field (arrows) plot - rc control the default params - savefig save the current figure - scatter make a scatter plot - setp set a handle graphics property - semilogx log x axis - semilogy log y axis - show show the figures - specgram a spectrogram plot - stem make a stem plot - subplot make a subplot (numrows, numcols, axesnum) - table add a table to the axes - text add some text at location x,y to the current axes - title add a title to the current axes - xlabel add an xlabel to the current axes - ylabel add a ylabel to the current axes - ========= ================================================= + ========= ================================================= + Command Description + ========= ================================================= + axes Create a new axes + axis Set or return the current axis limits + bar make a bar chart + boxplot make a box and whiskers chart + cla clear current axes + clabel label a contour plot + clf clear a figure window + close close a figure window + colorbar add a colorbar to the current figure + cohere make a plot of coherence + contour make a contour plot + contourf make a filled contour plot + csd make a plot of cross spectral density + draw force a redraw of the current figure + errorbar make an errorbar graph + figlegend add a legend to the figure + figimage add an image to the figure, w/o resampling + figtext add text in figure coords + figure create or change active figure + fill make filled polygons + fill_between make filled polygons + gca return the current axes + gcf return the current figure + gci get the current image, or None + getp get a handle graphics property + hist make a histogram + hold set the hold state on current axes + legend add a legend to the axes + loglog a log log plot + imread load image file into array + imshow plot image data + matshow display a matrix in a new figure preserving aspect + pcolor make a pseudocolor plot + plot make a line plot + plotfile plot data from a flat file + psd make a plot of power spectral density + quiver make a direction field (arrows) plot + rc control the default params + savefig save the current figure + scatter make a scatter plot + setp set a handle graphics property + semilogx log x axis + semilogy log y axis + show show the figures + specgram a spectrogram plot + stem make a stem plot + subplot make a subplot (numrows, numcols, axesnum) + table add a table to the axes + text add some text at location x,y to the current axes + title add a title to the current axes + xlabel add an xlabel to the current axes + ylabel add a ylabel to the current axes + ========= ================================================= The following commands will set the default colormap accordingly: @@ -1493,7 +1494,6 @@ ## Plotting part 2: autogenerated wrappers for axes methods ## -### Do not edit below this point # This function was autogenerated by boilerplate.py. Do not edit as # changes will be lost def acorr(*args, **kwargs): @@ -1870,6 +1870,50 @@ # This function was autogenerated by boilerplate.py. Do not edit as # changes will be lost +def fill_between(*args, **kwargs): + # allow callers to override the hold state by passing hold=True|False + b = ishold() + h = kwargs.pop('hold', None) + if h is not None: + hold(h) + try: + ret = gca().fill_between(*args, **kwargs) + draw_if_interactive() + except: + hold(b) + raise + + hold(b) + return ret +if Axes.fill_between.__doc__ is not None: + fill_between.__doc__ = dedent(Axes.fill_between.__doc__) + """ + +Additional kwargs: hold = [True|False] overrides default hold state""" + +# This function was autogenerated by boilerplate.py. Do not edit as +# changes will be lost +def hexbin(*args, **kwargs): + # allow callers to override the hold state by passing hold=True|False + b = ishold() + h = kwargs.pop('hold', None) + if h is not None: + hold(h) + try: + ret = gca().hexbin(*args, **kwargs) + draw_if_interactive() + except: + hold(b) + raise + gci._current = ret + hold(b) + return ret +if Axes.hexbin.__doc__ is not None: + hexbin.__doc__ = dedent(Axes.hexbin.__doc__) + """ + +Additional kwargs: hold = [True|False] overrides default hold state""" + +# This function was autogenerated by boilerplate.py. Do not edit as +# changes will be lost def hist(*args, **kwargs): # allow callers to override the hold state by passing hold=True|False b = ishold() @@ -2156,28 +2200,6 @@ # This function was autogenerated by boilerplate.py. Do not edit as # changes will be lost -def hexbin(*args, **kwargs): - # allow callers to override the hold state by passing hold=True|False - b = ishold() - h = kwargs.pop('hold', None) - if h is not None: - hold(h) - try: - ret = gca().hexbin(*args, **kwargs) - draw_if_interactive() - except: - hold(b) - raise - gci._current = ret - hold(b) - return ret -if Axes.hexbin.__doc__ is not None: - hexbin.__doc__ = dedent(Axes.hexbin.__doc__) + """ - -Additional kwargs: hold = [True|False] overrides default hold state""" - -# This function was autogenerated by boilerplate.py. Do not edit as -# changes will be lost def semilogx(*args, **kwargs): # allow callers to override the hold state by passing hold=True|False b = ishold() @@ -2438,10 +2460,8 @@ # changes will be lost def autumn(): ''' - Set the default colormap to *autumn* and apply to current image if any. - - .. seealso:: - :func:`colormaps` + set the default colormap to autumn and apply to current image if any. + See help(colormaps) for more information ''' rc('image', cmap='autumn') im = gci() @@ -2455,10 +2475,8 @@ # changes will be lost def bone(): ''' - Set the default colormap to bone and apply to current image if any. - - .. seealso:: - :func:`colormaps` + set the default colormap to bone and apply to current image if any. + See help(colormaps) for more information ''' rc('image', cmap='bone') im = gci() @@ -2472,10 +2490,8 @@ # changes will be lost def cool(): ''' - Set the default colormap to cool and apply to current image if any. - - .. seealso:: - :func:`colormaps` + set the default colormap to cool and apply to current image if any. + See help(colormaps) for more information ''' rc('image', cmap='cool') im = gci() @@ -2489,10 +2505,8 @@ # changes will be lost def copper(): ''' - Set the default colormap to copper and apply to current image if any. - - .. seealso:: - :func:`colormaps` + set the default colormap to copper and apply to current image if any. + See help(colormaps) for more information ''' rc('image', cmap='copper') im = gci() @@ -2506,10 +2520,8 @@ # changes will be lost def flag(): ''' - Set the default colormap to flag and apply to current image if any. - - .. seealso:: - :func:`colormaps` + set the default colormap to flag and apply to current image if any. + See help(colormaps) for more information ''' rc('image', cmap='flag') im = gci() @@ -2523,10 +2535,8 @@ # changes will be lost def gray(): ''' - Set the default colormap to gray and apply to current image if any. - - .. seealso:: - :func:`colormaps` + set the default colormap to gray and apply to current image if any. + See help(colormaps) for more information ''' rc('image', cmap='gray') im = gci() @@ -2540,10 +2550,8 @@ # changes will be lost def hot(): ''' - Set the default colormap to hot and apply to current image if any. - - .. seealso:: - :func:`colormaps` + set the default colormap to hot and apply to current image if any. + See help(colormaps) for more information ''' rc('image', cmap='hot') im = gci() @@ -2557,10 +2565,8 @@ # changes will be lost def hsv(): ''' - Set the default colormap to hsv and apply to current image if any. - - .. seealso:: - :func:`colormaps` + set the default colormap to hsv and apply to current image if any. + See help(colormaps) for more information ''' rc('image', cmap='hsv') im = gci() @@ -2574,10 +2580,8 @@ # changes will be lost def jet(): ''' - Set the default colormap to jet and apply to current image if any. - - .. seealso:: - :func:`colormaps` + set the default colormap to jet and apply to current image if any. + See help(colormaps) for more information ''' rc('image', cmap='jet') im = gci() @@ -2591,10 +2595,8 @@ # changes will be lost def pink(): ''' - Set the default colormap to pink and apply to current image if any. - - .. seealso:: - :func:`colormaps` + set the default colormap to pink and apply to current image if any. + See help(colormaps) for more information ''' rc('image', cmap='pink') im = gci() @@ -2608,10 +2610,8 @@ # changes will be lost def prism(): ''' - Set the default colormap to prism and apply to current image if any. - - .. seealso:: - :func:`colormaps` + set the default colormap to prism and apply to current image if any. + See help(colormaps) for more information ''' rc('image', cmap='prism') im = gci() @@ -2625,10 +2625,8 @@ # changes will be lost def spring(): ''' - Set the default colormap to spring and apply to current image if any. - - .. seealso:: - :func:`colormaps` + set the default colormap to spring and apply to current image if any. + See help(colormaps) for more information ''' rc('image', cmap='spring') im = gci() @@ -2642,10 +2640,8 @@ # changes will be lost def summer(): ''' - Set the default colormap to summer and apply to current image if any. - - .. seealso:: - :func:`colormaps` + set the default colormap to summer and apply to current image if any. + See help(colormaps) for more information ''' rc('image', cmap='summer') im = gci() @@ -2659,10 +2655,8 @@ # changes will be lost def winter(): ''' - Set the default colormap to winter and apply to current image if any. - - .. seealso:: - :func:`colormaps` + set the default colormap to winter and apply to current image if any. + See help(colormaps) for more information ''' rc('image', cmap='winter') im = gci() @@ -2676,10 +2670,8 @@ # changes will be lost def spectral(): ''' - Set the default colormap to spectral and apply to current image if any. - - .. seealso:: - :func:`colormaps` + set the default colormap to spectral and apply to current image if any. + See help(colormaps) for more information ''' rc('image', cmap='spectral') im = gci() @@ -2687,3 +2679,5 @@ if im is not None: im.set_cmap(cm.spectral) draw_if_interactive() + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6436 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6436&view=rev Author: jdh2358 Date: 2008年11月23日 19:18:24 +0000 (2008年11月23日) Log Message: ----------- fixed text docstring Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/text.py Modified: trunk/matplotlib/lib/matplotlib/text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/text.py 2008年11月23日 19:16:40 UTC (rev 6435) +++ trunk/matplotlib/lib/matplotlib/text.py 2008年11月23日 19:18:24 UTC (rev 6436) @@ -375,7 +375,7 @@ if not isinstance(self.arrow_patch, FancyArrowPatch): return - + if self._bbox_patch: trans = self.get_transform() @@ -1295,8 +1295,8 @@ instance is created with the given dictionary and is drawn. Otherwise, a YAArow patch instance is created and drawn. Valid keys for YAArow are - + ========= =========================================================== Key Description ========= =========================================================== @@ -1314,10 +1314,10 @@ Valid keys for FancyArrowPatch are - + =============== ====================================================== - Key Description + Key Description =============== ====================================================== arrowstyle connectionstyle @@ -1383,7 +1383,7 @@ self.arrowprops = arrowprops self.arrow = None - + if arrowprops and arrowprops.has_key("arrowstyle"): self._arrow_relpos = arrowprops.pop("relpos", (0.5, 0.5)) @@ -1392,7 +1392,7 @@ else: self.arrow_patch = None - + __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd def contains(self,event): @@ -1402,7 +1402,7 @@ t = t or a # self.arrow_patch is currently not checked as this can be a line - JJ - + return t,tinfo @@ -1551,7 +1551,7 @@ # Then it will be shrinked by shirnkA and shrinkB # (in points). If patch A is not set, self.bbox_patch # is used. - + self.arrow_patch.set_positions((ox0, oy0), (ox1,oy1)) mutation_scale = d.pop("mutation_scale", self.get_size()) self.arrow_patch.set_mutation_scale(mutation_scale) @@ -1562,7 +1562,7 @@ else: patchA = d.pop("patchA", self._bbox) self.arrow_patch.set_patchA(patchA) - + else: # pick the x,y corner of the text bbox closest to point This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6435 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6435&view=rev Author: jdh2358 Date: 2008年11月23日 19:16:40 +0000 (2008年11月23日) Log Message: ----------- remove deprecated fill example Removed Paths: ------------- trunk/matplotlib/examples/pylab_examples/fill_between_posneg.py Deleted: trunk/matplotlib/examples/pylab_examples/fill_between_posneg.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/fill_between_posneg.py 2008年11月23日 19:15:01 UTC (rev 6434) +++ trunk/matplotlib/examples/pylab_examples/fill_between_posneg.py 2008年11月23日 19:16:40 UTC (rev 6435) @@ -1,101 +0,0 @@ -#!/usr/bin/env python -""" -From: James Boyle <bo...@ll...> -Subject: possible candidate for examples directory using fill -To: John Hunter <jdh...@ni...> -Date: Tue, 8 Mar 2005 15:44:11 -0800 - -I often compare the output from two sensors and I am interested in the -sign of the differences. - -I wrote the enclosed code for find the polygons of the positive and -negative regions of the difference of two curves. It is written for -simple-minded straightforwardness rather than speed or elegance. -It is easy to fill in the two sets of polygons with contrasting colors. -For efficiency one could use collections but my curves are such that -fill is quick enough. - -The code uses a simple linear technique to find the crossover point, -this too could be made more sophisticated if one desired. - -I have found this code to be very handy for the comparisons I perform -- -maybe someone else would find it useful. - ---Jim -""" - -#!/usr/bin/env python - -from pylab import * - -def findZero(i,x,y1,y2): - im1 = i-1 - m1 = (y1[i] - y1[im1])/(x[i] - x[im1]) - m2 = (y2[i] - y2[im1])/(x[i] - x[im1]) - b1 = y1[im1] - m1*x[im1] - b2 = y2[im1] - m2*x[im1] - xZero = (b1 - b2)/(m2 - m1) - yZero = m1*xZero + b1 - return (xZero, yZero) - -def posNegFill(x,y1,y2): - diff = y2 - y1 - pos = [] - neg = [] - xx1 = [x[0]] - xx2 = [x[0]] - yy1 = [y1[0]] - yy2 = [y2[0]] - oldSign = (diff[0] < 0 ) - npts = x.shape[0] - for i in range(1,npts): - newSign = (diff[i] < 0) - if newSign != oldSign: - xz,yz = findZero(i,x,y1,y2) - xx1.append(xz) - yy1.append(yz) - xx2.reverse() - xx1.extend(xx2) - yy2.reverse() - yy1.extend(yy2) - if oldSign: - neg.append( (xx1,yy1) ) - else: - pos.append( (xx1,yy1) ) - xx1 = [xz,x[i]] - xx2 = [xz,x[i]] - yy1 = [yz,y1[i]] - yy2 = [yz,y2[i]] - oldSign = newSign - else: - xx1.append( x[i]) - xx2.append( x[i]) - yy1.append(y1[i]) - yy2.append(y2[i]) - if i == npts-1: - xx2.reverse() - xx1.extend(xx2) - yy2.reverse() - yy1.extend(yy2) - if oldSign : - neg.append( (xx1,yy1) ) - else: - pos.append( (xx1,yy1) ) - return pos,neg - -x1 = arange(0, 2, 0.01) -y1 = sin(2*pi*x1) -y2 = sin(4*pi*x1) - -# find positive and negative polygons of difference -pos,neg = posNegFill(x1,y1,y2) -# positive y2 > y1 is blue -for x,y in pos: - p = fill(x,y,'b') - -# negative Y2 < y1 is red -for x,y in neg: - p = fill(x,y,'r') - -show() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6434 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6434&view=rev Author: jdh2358 Date: 2008年11月23日 19:15:01 +0000 (2008年11月23日) Log Message: ----------- updated api for fill_between_where and span_where Modified Paths: -------------- trunk/matplotlib/examples/api/fill_where_demo.py trunk/matplotlib/lib/matplotlib/collections.py Modified: trunk/matplotlib/examples/api/fill_where_demo.py =================================================================== --- trunk/matplotlib/examples/api/fill_where_demo.py 2008年11月23日 19:05:58 UTC (rev 6433) +++ trunk/matplotlib/examples/api/fill_where_demo.py 2008年11月23日 19:15:01 UTC (rev 6434) @@ -1,6 +1,9 @@ """ Illustrate some helper functions for shading regions where a logical mask is True + +See :meth:`matplotlib.collections.PolyCollection.fill_between_where` +and :meth:`matplotlib.collections.BrokenBarHCollection.span_where` """ import numpy as np import matplotlib.pyplot as plt @@ -18,26 +21,26 @@ ax.axhline(0, color='black', lw=2) collection = collections.PolyCollection.fill_between_where( - t, s1, s2, s1>=s2, color='green', alpha=0.5) + t, s1, s2, where=s1>=s2, color='green', alpha=0.5) ax.add_collection(collection) collection = collections.PolyCollection.fill_between_where( - t, s1, s2, s1<=s2, color='red', alpha=0.5) + t, s1, s2, where=s1<=s2, color='red', alpha=0.5) ax.add_collection(collection) fig = plt.figure() ax = fig.add_subplot(111) -ax.set_title('using span_masked') +ax.set_title('using span_where') ax.plot(t, s1, '-') ax.axhline(0, color='black', lw=2) -collection = collections.BrokenBarHCollection.span_masked( - t, s1>0, ymin=0, ymax=1, facecolor='green', alpha=0.5) +collection = collections.BrokenBarHCollection.span_where( + t, ymin=0, ymax=1, where=s1>0, facecolor='green', alpha=0.5) ax.add_collection(collection) -collection = collections.BrokenBarHCollection.span_masked( - t, s1<0, ymin=-1, ymax=0, facecolor='red', alpha=0.5) +collection = collections.BrokenBarHCollection.span_where( + t, ymin=-1, ymax=0, where=s1<0, facecolor='red', alpha=0.5) ax.add_collection(collection) Modified: trunk/matplotlib/lib/matplotlib/collections.py =================================================================== --- trunk/matplotlib/lib/matplotlib/collections.py 2008年11月23日 19:05:58 UTC (rev 6433) +++ trunk/matplotlib/lib/matplotlib/collections.py 2008年11月23日 19:15:01 UTC (rev 6434) @@ -674,10 +674,10 @@ @staticmethod - def fill_between_where(x, y1, y2, mask, **kwargs): + def fill_between_where(x, y1, y2, where, **kwargs): """ Create a :class:`PolyCollection` filling the regions between *y* - and *yboundary7* where ``mask==True`` + and *yboundary7* where ``where==True`` *x* @@ -689,7 +689,7 @@ *y2* an N length scalar or np array of the x data - *mask* + *where* an N length numpy boolean array *kwargs* @@ -705,7 +705,7 @@ assert( (len(x)==len(y1)) and (len(x)==len(y2)) ) polys = [] - for ind0, ind1 in mlab.contiguous_regions(mask): + for ind0, ind1 in mlab.contiguous_regions(where): theseverts = [] xslice = x[ind0:ind1] y1slice = y1[ind0:ind1] @@ -756,17 +756,17 @@ @staticmethod - def span_masked(x, mask, ymin, ymax, **kwargs): + def span_where(x, ymin, ymax, where, **kwargs): """ Create a BrokenBarHCollection to plot horizontal bars from - over the regions in *x* where *mask* is True. The bars range + over the regions in *x* where *where* is True. The bars range on the y-axis from *ymin* to *ymax* A :class:`BrokenBarHCollection` is returned. **kwargs are passed on to the collection """ xranges = [] - for ind0, ind1 in mlab.contiguous_regions(mask): + for ind0, ind1 in mlab.contiguous_regions(where): xslice = x[ind0:ind1] if not len(xslice): continue This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.