From: <lee...@us...> - 2009-05-17 21:36:42
|
Revision: 7114 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7114&view=rev Author: leejjoon Date: 2009-05-17 21:36:34 +0000 (Sun, 17 May 2009) Log Message: ----------- a warning won't be issued for semilog axes if aspect="auto" Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2009-05-17 18:00:10 UTC (rev 7113) +++ trunk/matplotlib/lib/matplotlib/axes.py 2009-05-17 21:36:34 UTC (rev 7114) @@ -1137,10 +1137,11 @@ aspect_scale_mode = "log" elif (xscale == "linear" and yscale == "log") or \ (xscale == "log" and yscale == "linear"): - warnings.warn( - 'aspect is not supported for Axes with xscale=%s, yscale=%s' \ - % (xscale, yscale)) - aspect = "auto" + if aspect is not "auto": + warnings.warn( + 'aspect is not supported for Axes with xscale=%s, yscale=%s' \ + % (xscale, yscale)) + aspect = "auto" else: # some custom projections have their own scales. pass This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2009-05-22 17:36:40
|
Revision: 7134 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7134&view=rev Author: efiring Date: 2009-05-22 17:36:28 +0000 (Fri, 22 May 2009) Log Message: ----------- Make polar_bar work with new Path._interpolation_steps attribute Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2009-05-22 14:24:55 UTC (rev 7133) +++ trunk/matplotlib/lib/matplotlib/axes.py 2009-05-22 17:36:28 UTC (rev 7134) @@ -4309,6 +4309,7 @@ ) label = '_nolegend_' r.update(kwargs) + r.get_path()._interpolation_steps = 100 #print r.get_label(), label, 'label' in kwargs self.add_patch(r) patches.append(r) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2009-06-07 14:13:18
|
Revision: 7194 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7194&view=rev Author: jdh2358 Date: 2009-06-07 14:13:12 +0000 (Sun, 07 Jun 2009) Log Message: ----------- update doc strings to point to new fill between demos Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2009-06-07 13:58:48 UTC (rev 7193) +++ trunk/matplotlib/lib/matplotlib/axes.py 2009-06-07 14:13:12 UTC (rev 7194) @@ -6019,7 +6019,7 @@ %(PolyCollection)s - .. plot:: mpl_examples/pylab_examples/fill_between.py + .. plot:: mpl_examples/pylab_examples/fill_between_demo.py.py .. seealso:: @@ -6126,7 +6126,7 @@ %(PolyCollection)s - .. plot:: mpl_examples/pylab_examples/fill_betweenx.py + .. plot:: mpl_examples/pylab_examples/fill_betweenx_demo.py .. seealso:: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2009-06-14 17:24:47
|
Revision: 7219 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7219&view=rev Author: jdh2358 Date: 2009-06-14 17:24:45 +0000 (Sun, 14 Jun 2009) Log Message: ----------- added variant of sf patch 2805653 for specgram kwargs pass thru to imshow Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2009-06-14 05:38:11 UTC (rev 7218) +++ trunk/matplotlib/lib/matplotlib/axes.py 2009-06-14 17:24:45 UTC (rev 7219) @@ -7530,14 +7530,14 @@ def specgram(self, x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none, window=mlab.window_hanning, noverlap=128, cmap=None, xextent=None, pad_to=None, sides='default', - scale_by_freq=None): + scale_by_freq=None, **kwargs): """ call signature:: specgram(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none, window=mlab.window_hanning, noverlap=128, cmap=None, xextent=None, pad_to=None, sides='default', - scale_by_freq=None) + scale_by_freq=None, **kwargs) Compute a spectrogram of data in *x*. Data are split into *NFFT* length segments and the PSD of each section is @@ -7562,8 +7562,13 @@ The default is (0,max(bins)), where bins is the return value from :func:`mlab.specgram` - Return value is (*Pxx*, *freqs*, *bins*, *im*): + *kwargs*: + Additional kwargs are passed on to imshow which makes the + specgram image + + Return value is (*Pxx*, *freqs*, *bins*, *im*): + - *bins* are the time points the spectrogram is calculated over - *freqs* is an array of frequencies - *Pxx* is a len(times) x len(freqs) array of power @@ -7590,7 +7595,7 @@ xmin, xmax = xextent freqs += Fc extent = xmin, xmax, freqs[0], freqs[-1] - im = self.imshow(Z, cmap, extent=extent) + im = self.imshow(Z, cmap, extent=extent, **kwargs) self.axis('auto') return Pxx, freqs, bins, im This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2009-06-14 17:34:41
|
Revision: 7220 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7220&view=rev Author: jdh2358 Date: 2009-06-14 17:34:40 +0000 (Sun, 14 Jun 2009) Log Message: ----------- fixed errorbar Nx2 docstring bug as described in sf bug 2804502 Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2009-06-14 17:24:45 UTC (rev 7219) +++ trunk/matplotlib/lib/matplotlib/axes.py 2009-06-14 17:34:40 UTC (rev 7220) @@ -4725,12 +4725,12 @@ Optional keyword arguments: - *xerr*/*yerr*: [ scalar | N, Nx1, Nx2 array-like ] + *xerr*/*yerr*: [ scalar | N, Nx1, or 2xN array-like ] If a scalar number, len(N) array-like object, or an Nx1 array-like object, errorbars are drawn +/- value. - If a rank-1, Nx2 Numpy array, errorbars are drawn at -column1 and - +column2 + If a rank-1, 2xN numpy array, errorbars are drawn at -row1 and + +row2 *fmt*: '-' The plot format symbol for *y*. If *fmt* is *None*, just plot the This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jr...@us...> - 2009-09-24 20:47:18
|
Revision: 7824 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7824&view=rev Author: jrevans Date: 2009-09-24 20:47:11 +0000 (Thu, 24 Sep 2009) Log Message: ----------- Fixed a comparison in update_patch_limits that compared data with being equall to zero. This will fail with unitized data. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2009-09-24 17:05:51 UTC (rev 7823) +++ trunk/matplotlib/lib/matplotlib/axes.py 2009-09-24 20:47:11 UTC (rev 7824) @@ -1444,8 +1444,9 @@ # scaling. We'll ignore rects with zero height or width in # the auto-scaling + # cannot check for '==0' since unitized data may not compare to zero if (isinstance(patch, mpatches.Rectangle) and - (patch.get_width()==0 or patch.get_height()==0)): + ((not patch.get_width()) or (notpatch.get_height()))): return vertices = patch.get_path().vertices if vertices.size > 0: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jr...@us...> - 2009-09-24 21:16:14
|
Revision: 7825 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7825&view=rev Author: jrevans Date: 2009-09-24 21:16:07 +0000 (Thu, 24 Sep 2009) Log Message: ----------- Fixed a typo. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2009-09-24 20:47:11 UTC (rev 7824) +++ trunk/matplotlib/lib/matplotlib/axes.py 2009-09-24 21:16:07 UTC (rev 7825) @@ -1446,7 +1446,7 @@ # cannot check for '==0' since unitized data may not compare to zero if (isinstance(patch, mpatches.Rectangle) and - ((not patch.get_width()) or (notpatch.get_height()))): + ((not patch.get_width()) or (not patch.get_height()))): return vertices = patch.get_path().vertices if vertices.size > 0: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lee...@us...> - 2009-11-11 23:59:39
|
Revision: 7951 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7951&view=rev Author: leejjoon Date: 2009-11-11 23:59:23 +0000 (Wed, 11 Nov 2009) Log Message: ----------- drawing images respect zorder among images even for noncomposite backend Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2009-11-10 21:03:51 UTC (rev 7950) +++ trunk/matplotlib/lib/matplotlib/axes.py 2009-11-11 23:59:23 UTC (rev 7951) @@ -1727,9 +1727,12 @@ # make a composite image blending alpha # list of (mimage.Image, ox, oy) + zorder_images = [(im.zorder, im) for im in self.images \ + if im.get_visible()] + zorder_images.sort() + mag = renderer.get_image_magnification() - ims = [(im.make_image(mag),0,0) - for im in self.images if im.get_visible()] + ims = [(im.make_image(mag),0,0) for z,im in zorder_images] l, b, r, t = self.bbox.extents This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <as...@us...> - 2009-11-12 22:48:11
|
Revision: 7958 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7958&view=rev Author: astraw Date: 2009-11-12 22:47:43 +0000 (Thu, 12 Nov 2009) Log Message: ----------- axes.py: remove redundant variable Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2009-11-12 22:17:24 UTC (rev 7957) +++ trunk/matplotlib/lib/matplotlib/axes.py 2009-11-12 22:47:43 UTC (rev 7958) @@ -1698,7 +1698,7 @@ artists.extend(self.spines.itervalues()) - dsu = [ (a.zorder, i, a) for i, a in enumerate(artists) + dsu = [ (a.zorder, a) for a in artists if not a.get_animated() ] dsu.sort() @@ -1721,7 +1721,7 @@ if len(self.images)<=1 or renderer.option_image_nocomposite(): for im in self.images: - dsu.append( (im.zorder, len(dsu), im) ) + dsu.append( (im.zorder, im) ) dsu.sort() # re-sort with images now else: # make a composite image blending alpha @@ -1757,11 +1757,11 @@ gc.restore() if dsu_rasterized: - for zorder, i, a in dsu_rasterized: + for zorder, a in dsu_rasterized: a.draw(renderer) renderer.stop_rasterizing() - for zorder, i, a in dsu: + for zorder, a in dsu: a.draw(renderer) renderer.close_group('axes') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lee...@us...> - 2009-12-11 16:57:53
|
Revision: 8022 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8022&view=rev Author: leejjoon Date: 2009-12-11 16:57:46 +0000 (Fri, 11 Dec 2009) Log Message: ----------- Axes.draw rearranged to support rasterization Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2009-12-11 00:59:34 UTC (rev 8021) +++ trunk/matplotlib/lib/matplotlib/axes.py 2009-12-11 16:57:46 UTC (rev 8022) @@ -30,6 +30,8 @@ import matplotlib.ticker as mticker import matplotlib.transforms as mtransforms +from operator import itemgetter + iterable = cbook.iterable is_string_like = cbook.is_string_like is_sequence_of_strings = cbook.is_sequence_of_strings @@ -1698,11 +1700,22 @@ artists.extend(self.spines.itervalues()) + dsu = [ (a.zorder, a) for a in artists if not a.get_animated() ] - dsu.sort(key=lambda x: x[0]) + # add images to dsu if the backend support compositing. + # otherwise, does the manaul compositing without adding images to dsu. + if len(self.images)<=1 or renderer.option_image_nocomposite(): + dsu.extend([(im.zorder, im) for im in self.images]) + _do_composite = False + else: + _do_composite = True + + + dsu.sort(key=itemgetter(0)) + # rasterize artists with negative zorder # if the minimum zorder is negative, start rasterization rasterization_zorder = self._rasterization_zorder @@ -1719,11 +1732,7 @@ if self.axison and self._frameon: self.patch.draw(renderer) - if len(self.images)<=1 or renderer.option_image_nocomposite(): - for im in self.images: - dsu.append( (im.zorder, im) ) - dsu.sort(key=lambda x: x[0]) # re-sort with images now - else: + if _do_composite: # make a composite image blending alpha # list of (mimage.Image, ox, oy) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2010-01-04 04:30:34
|
Revision: 8067 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8067&view=rev Author: efiring Date: 2010-01-04 04:30:24 +0000 (Mon, 04 Jan 2010) Log Message: ----------- Remove unnecessary private method. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2010-01-04 02:22:26 UTC (rev 8066) +++ trunk/matplotlib/lib/matplotlib/axes.py 2010-01-04 04:30:24 UTC (rev 8067) @@ -150,11 +150,8 @@ def set_color_cycle(self, clist=None): if clist is None: clist = rcParams['axes.color_cycle'] - self._colors = itertools.cycle(clist) + self.color_cycle = itertools.cycle(clist) - def _get_next_cycle_color(self): - return self._colors.next() - def __call__(self, *args, **kwargs): if self.axes.xaxis is not None and self.axes.yaxis is not None: @@ -225,7 +222,7 @@ def _makeline(self, x, y, kw, kwargs): kw = kw.copy() # Don't modify the original kw. if not 'color' in kw: - kw['color'] = self._get_next_cycle_color() + kw['color'] = self.color_cycle.next() # (can't use setdefault because it always evaluates # its second argument) seg = mlines.Line2D(x, y, @@ -239,7 +236,7 @@ try: facecolor = kw['color'] except KeyError: - facecolor = self._get_next_cycle_color() + facecolor = self.color_cycle.next() seg = mpatches.Polygon(np.hstack( (x[:,np.newaxis],y[:,np.newaxis])), facecolor = facecolor, @@ -4866,7 +4863,7 @@ if ecolor is None: if l0 is None: - ecolor = self._get_lines._get_next_cycle_color() + ecolor = self._get_lines.color_cycle.next() else: ecolor = l0.get_color() @@ -7163,7 +7160,7 @@ if orientation == 'horizontal': for m in n: - color = self._get_lines._get_next_cycle_color() + color = self._get_lines.color_cycle.next() patch = self.barh(bins[:-1]+boffset, m, height=width, left=bottom, align='center', log=log, color=color) @@ -7174,7 +7171,7 @@ boffset += dw elif orientation == 'vertical': for m in n: - color = self._get_lines._get_next_cycle_color() + color = self._get_lines.color_cycle.next() patch = self.bar(bins[:-1]+boffset, m, width=width, bottom=bottom, align='center', log=log, color=color) @@ -7219,7 +7216,7 @@ elif orientation != 'vertical': raise ValueError, 'invalid orientation: %s' % orientation - color = self._get_lines._get_next_cycle_color() + color = self._get_lines.color_cycle.next() if fill: patches.append( self.fill(x, y, closed=False, facecolor=color) ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2010-04-02 21:29:45
|
Revision: 8218 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8218&view=rev Author: efiring Date: 2010-04-02 21:29:38 +0000 (Fri, 02 Apr 2010) Log Message: ----------- Axes.hist: style changes, bug fixes Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2010-04-02 18:47:00 UTC (rev 8217) +++ trunk/matplotlib/lib/matplotlib/axes.py 2010-04-02 21:29:38 UTC (rev 8218) @@ -5311,7 +5311,7 @@ s = np.ma.ravel(s) # This doesn't have to match x, y in size. - c_is_stringy = is_string_like(c) or cbook.is_sequence_of_strings(c) + c_is_stringy = is_string_like(c) or is_sequence_of_strings(c) if not c_is_stringy: c = np.asanyarray(c) if c.size == x.size: @@ -6989,6 +6989,7 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None, cumulative=False, bottom=None, histtype='bar', align='mid', orientation='vertical', rwidth=None, log=False, + color=None, **kwargs): """ call signature:: @@ -7002,16 +7003,21 @@ [*patches0*, *patches1*,...]) if the input contains multiple data. + Multiple data can be provided via *x* as a list of datasets + of potentially different length ([*x0*, *x1*, ...]), or as + a 2-D ndarray in which each column is a dataset. Note that + the ndarray form is transposed relative to the list form. + + Masked arrays are not supported at present. + Keyword arguments: *bins*: Either an integer number of bins or a sequence giving the - bins. *x* are the data to be binned. *x* can be an array, - a 2D array with multiple data in its columns, or a list of - arrays with data of different length. Note, if *bins* - is an integer input argument=numbins, *bins* + 1 bin edges - will be returned, compatible with the semantics of - :func:`numpy.histogram` with the *new* = True argument. + bins. If *bins* is an integer, *bins* + 1 bin edges + will be returned, consistent with :func:`numpy.histogram` + for numpy version >= 1.3, and with the *new* = True argument + in earlier versions. Unequally spaced bins are supported if *bins* is a sequence. *range*: @@ -7090,6 +7096,9 @@ be filtered out and only the non-empty (*n*, *bins*, *patches*) will be returned. + *color*: + + kwargs are used to update the properties of the hist :class:`~matplotlib.patches.Rectangle` instances: @@ -7117,65 +7126,74 @@ # NOTE: the range keyword overwrites the built-in func range !!! # needs to be fixed in numpy !!! + # Validate string inputs here so we don't have to clutter + # subsequent code. + if histtype not in ['bar', 'barstacked', 'step', 'stepfilled']: + raise ValueError("histtype %s is not recognized" % histtype) + + if align not in ['left', 'mid', 'right']: + raise ValueError("align kwarg %s is not recognized" % align) + + if orientation not in [ 'horizontal', 'vertical']: + raise ValueError( + "orientation kwarg %s is not recognized" % orientation) + + if kwargs.get('width') is not None: raise DeprecationWarning( 'hist now uses the rwidth to give relative width ' 'and not absolute width') - try: - # make sure a copy is created: don't use asarray - x = np.transpose(np.array(x)) - 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; ' + if isinstance(x, np.ndarray): + # TODO: support masked arrays; + # Why is the copy needed? + x = np.array(x, copy=True, subok=False) + if x.ndim == 2: + x = x.T + elif x.ndim == 1: + x.shape = (1, x.shape[0]) + else: + raise ValueError("x must be 1D or 2D") + if x.shape[1] < x.shape[0]: + warnings.warn('2D hist input should be nsamples x nvariables; ' 'this looks transposed') - except ValueError: + else: # multiple hist with data of different length - if iterable(x[0]) and not is_string_like(x[0]): - tx = [] - for i in xrange(len(x)): - tx.append( np.array(x[i]) ) - x = tx - else: - raise ValueError, 'Can not use provided data to create a histogram' + x = [np.array(xi) for xi in x] + nx = len(x) # number of datasets + if weights is not None: - try: - w = np.transpose(np.array(weights)) - if len(w.shape)==1: + if isinstance(w, np.ndarray): + w = np.array(weights) + if w.ndim == 2: + w = w.T + elif w.ndim == 1: w.shape = (1, w.shape[0]) - except: - if iterable(weights[0]) and not is_string_like(weights[0]): - tw = [] - for i in xrange(len(weights)): - tw.append( np.array(weights[i]) ) - w = tw else: - raise ValueError, 'Can not use provided weights to create a hist' + raise ValueError("weights must be 1D or 2D") + else: + w = [np.array(wi) for wi in weights] - if len(x) != len(w): - raise ValueError, 'weights should have the same shape as x' - for i in xrange(len(x)): - if len(x[i]) != len(w[i]): - raise ValueError, 'weights should have the same shape as x' + if len(w) != nx: + raise ValueError('weights should have the same shape as x') + for i in xrange(nx): + if len(w[i]) != len(x[i]): + raise ValueError( + 'weights should have the same shape as x') else: - w = [None]*len(x) + w = [None]*nx # Check whether bins or range are given explicitly. In that # case do not autoscale axes. binsgiven = (cbook.iterable(bins) or range != None) - # check the version of the numpy + hist_kwargs = dict(range=range, normed=bool(normed)) if np.__version__ < "1.3": # version 1.1 and 1.2 - hist_kwargs = dict(range=range, - normed=bool(normed), new=True) - else: # version 1.3 and later, drop new=True - hist_kwargs = dict(range=range, - normed=bool(normed)) + hist_kwargs['new'] = True n = [] - for i in xrange(len(x)): + for i in xrange(nx): # this will automatically overwrite bins, # so that each histogram uses the same bins m, bins = np.histogram(x[i], bins, weights=w[i], **hist_kwargs) @@ -7195,60 +7213,50 @@ if histtype.startswith('bar'): totwidth = np.diff(bins) - stacked = False - if rwidth is not None: dr = min(1., max(0., rwidth)) - elif len(n)>1: dr = 0.8 - else: dr = 1.0 + if rwidth is not None: + dr = min(1.0, max(0.0, rwidth)) + elif len(n)>1: + dr = 0.8 + else: + dr = 1.0 if histtype=='bar': - width = dr*totwidth/len(n) + width = dr*totwidth/nx dw = width - if len(n)>1: - boffset = -0.5*dr*totwidth*(1.-1./len(n)) + if nx > 1: + boffset = -0.5*dr*totwidth*(1.0-1.0/nx) else: boffset = 0.0 + stacked = False elif histtype=='barstacked': width = dr*totwidth boffset, dw = 0.0, 0.0 - stacked = True - else: - raise ValueError, 'invalid histtype: %s' % histtype if align == 'mid' or align == 'edge': boffset += 0.5*totwidth elif align == 'right': boffset += totwidth - elif align != 'left' and align != 'center': - raise ValueError, 'invalid align: %s' % align if orientation == 'horizontal': - for m in n: - color = self._get_lines.color_cycle.next() - patch = self.barh(bins[:-1]+boffset, m, height=width, - left=bottom, align='center', log=log, - color=color) - patches.append(patch) - if stacked: - if bottom is None: bottom = 0.0 - bottom += m - boffset += dw - elif orientation == 'vertical': - for m in n: - color = self._get_lines.color_cycle.next() - patch = self.bar(bins[:-1]+boffset, m, width=width, - bottom=bottom, align='center', log=log, - color=color) - patches.append(patch) - if stacked: - if bottom is None: bottom = 0.0 - bottom += m - boffset += dw - else: - raise ValueError, 'invalid orientation: %s' % orientation + _barfunc = self.barh + else: # orientation == 'vertical' + _barfunc = self.bar + for m in n: + color = self._get_lines.color_cycle.next() + patch = _barfunc(bins[:-1]+boffset, m, width, bottom, + align='center', log=log, + color=color) + patches.append(patch) + if stacked: + if bottom is None: + bottom = 0.0 + bottom += m + boffset += dw + elif histtype.startswith('step'): x = np.zeros( 2*len(bins), np.float ) y = np.zeros( 2*len(bins), np.float ) @@ -7259,21 +7267,15 @@ x -= 0.5*(bins[1]-bins[0]) elif align == 'right': x += 0.5*(bins[1]-bins[0]) - elif align != 'mid' and align != 'edge': - raise ValueError, 'invalid align: %s' % align if log: y[0],y[-1] = 1e-100, 1e-100 if orientation == 'horizontal': self.set_xscale('log') - elif orientation == 'vertical': + else: # orientation == 'vertical' self.set_yscale('log') - fill = False - if histtype == 'stepfilled': - fill = True - elif histtype != 'step': - raise ValueError, 'invalid histtype: %s' % histtype + fill = (histtype == 'stepfilled') for m in n: y[1:-1:2], y[2::2] = m, m @@ -7281,8 +7283,6 @@ y[y<1e-100]=1e-100 if orientation == 'horizontal': x,y = y,x - elif orientation != 'vertical': - raise ValueError, 'invalid orientation: %s' % orientation color = self._get_lines.color_cycle.next() if fill: @@ -7307,17 +7307,17 @@ self.dataLim.intervaly = (ymin, ymax) self.autoscale_view() - else: - raise ValueError, 'invalid histtype: %s' % histtype + label = kwargs.pop('label', '_nolegend_') - label = kwargs.pop('label', '') - if is_string_like(label): - labels = [label] + ['_nolegend_']*(len(patches)-1) - elif is_sequence_of_strings: - labels = list(label) + ['_nolegend_']*(len(patches)-1) + labels = [label] + elif is_sequence_of_strings(label): + labels = list(label) else: - raise ValueError, 'invalid label: must be string or sequence of strings' + raise ValueError( + 'invalid label: must be string or sequence of strings') + if len(labels) < nx: + labels += ['_nolegend_'] * (nx - len(labels)) for (patch, lbl) in zip(patches, labels): for p in patch: @@ -7329,14 +7329,16 @@ self.set_autoscale_on(False) if orientation == 'vertical': self.autoscale_view(scalex=False, scaley=True) - XL = self.xaxis.get_major_locator().view_limits(bins[0], bins[-1]) + XL = self.xaxis.get_major_locator().view_limits( + bins[0], bins[-1]) self.set_xbound(XL) else: self.autoscale_view(scalex=True, scaley=False) - YL = self.yaxis.get_major_locator().view_limits(bins[0], bins[-1]) + YL = self.yaxis.get_major_locator().view_limits( + bins[0], bins[-1]) self.set_ybound(YL) - if len(n)==1: + if nx == 1: return n[0], bins, cbook.silent_list('Patch', patches[0]) else: return n, bins, cbook.silent_list('Lists of Patches', patches) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2010-04-03 07:18:24
|
Revision: 8219 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8219&view=rev Author: efiring Date: 2010-04-03 07:18:18 +0000 (Sat, 03 Apr 2010) Log Message: ----------- Axes.hist: add color kwarg. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2010-04-02 21:29:38 UTC (rev 8218) +++ trunk/matplotlib/lib/matplotlib/axes.py 2010-04-03 07:18:18 UTC (rev 8219) @@ -7097,8 +7097,10 @@ *patches*) will be returned. *color*: + Color spec or sequence of color specs, one per + dataset. Default (*None*) uses the standard line + color sequence. - kwargs are used to update the properties of the hist :class:`~matplotlib.patches.Rectangle` instances: @@ -7163,6 +7165,14 @@ nx = len(x) # number of datasets + if color is None: + color = [self._get_lines.color_cycle.next() + for i in xrange(nx)] + else: + color = mcolors.colorConverter.to_rgba_array(color) + if len(color) != nx: + raise ValueError("color kwarg must have one color per dataset") + if weights is not None: if isinstance(w, np.ndarray): w = np.array(weights) @@ -7245,11 +7255,10 @@ else: # orientation == 'vertical' _barfunc = self.bar - for m in n: - color = self._get_lines.color_cycle.next() + for m, c in zip(n, color): patch = _barfunc(bins[:-1]+boffset, m, width, bottom, align='center', log=log, - color=color) + color=c) patches.append(patch) if stacked: if bottom is None: @@ -7277,20 +7286,19 @@ fill = (histtype == 'stepfilled') - for m in n: + for m, c in zip(n, color): y[1:-1:2], y[2::2] = m, m if log: y[y<1e-100]=1e-100 if orientation == 'horizontal': x,y = y,x - color = self._get_lines.color_cycle.next() if fill: patches.append( self.fill(x, y, - closed=False, facecolor=color) ) + closed=False, facecolor=c) ) else: patches.append( self.fill(x, y, - closed=False, edgecolor=color, fill=False) ) + closed=False, edgecolor=c, fill=False) ) # adopted from adjust_x/ylim part of the bar method if orientation == 'horizontal': This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2010-04-05 01:07:09
|
Revision: 8221 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8221&view=rev Author: efiring Date: 2010-04-05 01:06:57 +0000 (Mon, 05 Apr 2010) Log Message: ----------- Axes.hist: make 'label' an explicit kwarg, like 'color' Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2010-04-03 23:22:48 UTC (rev 8220) +++ trunk/matplotlib/lib/matplotlib/axes.py 2010-04-05 01:06:57 UTC (rev 8221) @@ -6989,7 +6989,7 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None, cumulative=False, bottom=None, histtype='bar', align='mid', orientation='vertical', rwidth=None, log=False, - color=None, + color=None, label=None, **kwargs): """ call signature:: @@ -7101,24 +7101,21 @@ dataset. Default (*None*) uses the standard line color sequence. - kwargs are used to update the properties of the hist - :class:`~matplotlib.patches.Rectangle` instances: + *label*: + String, or sequence of strings to match multiple + datasets. Bar charts yield multiple patches per + dataset, but only the first gets the label, so + that the legend command will work as expected:: - %(Rectangle)s + ax.hist(10+2*np.random.randn(1000), label='men') + ax.hist(12+3*np.random.randn(1000), label='women', alpha=0.5) + ax.legend() - You can use labels for your histogram, and only the first - :class:`~matplotlib.patches.Rectangle` gets the label (the - others get the magic string '_nolegend_'. This will make the - histograms work in the intuitive way for bar charts:: + kwargs are used to update the properties of the + :class:`~matplotlib.patches.Patch` instances returned by *hist*: - ax.hist(10+2*np.random.randn(1000), label='men') - ax.hist(12+3*np.random.randn(1000), label='women', alpha=0.5) - ax.legend() + %(Patch)s - label can also be a sequence of strings. If multiple data is - provided in *x*, the labels are asigned sequentially to the - histograms. - **Example:** .. plot:: mpl_examples/pylab_examples/histogram_demo.py @@ -7315,9 +7312,9 @@ self.dataLim.intervaly = (ymin, ymax) self.autoscale_view() - label = kwargs.pop('label', '_nolegend_') - - if is_string_like(label): + if label is None: + labels = ['_nolegend_'] + elif is_string_like(label): labels = [label] elif is_sequence_of_strings(label): labels = list(label) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2010-04-22 03:23:01
|
Revision: 8264 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8264&view=rev Author: efiring Date: 2010-04-22 03:22:55 +0000 (Thu, 22 Apr 2010) Log Message: ----------- Axes: save "tight" state; margin() default is now tight=True Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2010-04-21 21:49:53 UTC (rev 8263) +++ trunk/matplotlib/lib/matplotlib/axes.py 2010-04-22 03:22:55 UTC (rev 8264) @@ -838,6 +838,7 @@ self._autoscaleYon = True self._xmargin = 0 self._ymargin = 0 + self._tight = True self._update_transScale() # needed? self._get_lines = _process_plot_var_args(self) @@ -1231,7 +1232,7 @@ elif s in ('equal', 'tight', 'scaled', 'normal', 'auto', 'image'): self.set_autoscale_on(True) self.set_aspect('auto') - self.autoscale_view() + self.autoscale_view(tight=False) # self.apply_aspect() if s=='equal': self.set_aspect('equal', adjustable='datalim') @@ -1646,17 +1647,22 @@ :: - margins(margin, tight=True) + margins(margin) - margins(xmargin, ymargin, tight=True) + margins(xmargin, ymargin) - margins(x=xmargin, y=ymargin, tight=True) + margins(x=xmargin, y=ymargin) + margins(..., tight=False) + All three forms above set the xmargin and ymargin parameters. All keyword parameters are optional. A single argument specifies both xmargin and ymargin. The *tight* parameter is passed to :meth:`autoscale_view`, which is executed after - a margin is changed. + a margin is changed; the default here is *True*, on the + assumption that when margins are specified, no additional + padding to match tick marks is usually desired. Setting + *tight* to *None* will preserve the previous setting. Specifying any margin changes only the autoscaling; for example, if *xmargin* is not zero, then *xmargin* times the X data @@ -1667,7 +1673,7 @@ if not args and not kw: return self._ymargin, self._ymargin - tight = kw.pop('tight', False) + tight = kw.pop('tight', True) mx = kw.pop('x', None) my = kw.pop('y', None) if len(args) == 1: @@ -1697,7 +1703,7 @@ return self._rasterization_zorder - def autoscale_view(self, tight=False, scalex=True, scaley=True): + def autoscale_view(self, tight=None, scalex=True, scaley=True): """ autoscale the view limits using the data limits. You can selectively autoscale only a single axis, eg, the xaxis by @@ -1725,7 +1731,9 @@ y0 -= delta y1 += delta - if (tight or (len(self.images)>0 and + if tight is not None: + self._tight = bool(tight) + if (self._tight or (len(self.images)>0 and len(self.lines)==0 and len(self.patches)==0)): if scalex and self._autoscaleXon: @@ -2027,7 +2035,7 @@ raise AttributeError( "This method only works with the ScalarFormatter.") - def locator_params(self, axis='both', tight=False, **kwargs): + def locator_params(self, axis='both', tight=None, **kwargs): """ Convenience method for controlling tick locators. @@ -2038,7 +2046,8 @@ default is 'both'. *tight* - [True | False] Parameter passed to :meth:`autoscale_view`. + [True | False | None] Parameter passed to :meth:`autoscale_view`. + Default is None, for no change. Remaining keyword arguments are passed to directly to the :meth:`~matplotlib.ticker.MaxNLocator.set_params` method. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2010-04-22 07:49:20
|
Revision: 8266 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8266&view=rev Author: efiring Date: 2010-04-22 07:49:13 +0000 (Thu, 22 Apr 2010) Log Message: ----------- Axes.autoscale_view: ensure finite ranges; rearrange code for readability Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2010-04-22 03:34:10 UTC (rev 8265) +++ trunk/matplotlib/lib/matplotlib/axes.py 2010-04-22 07:49:13 UTC (rev 8266) @@ -1710,45 +1710,41 @@ setting *scaley* to *False*. The autoscaling preserves any axis direction reversal that has already been done. """ + if tight is not None: + self._tight = bool(tight) # if image data only just use the datalim + _tight = self._tight or (len(self.images)>0 and + len(self.lines)==0 and + len(self.patches)==0) + if scalex and self._autoscaleXon: xshared = self._shared_x_axes.get_siblings(self) dl = [ax.dataLim for ax in xshared] bb = mtransforms.BboxBase.union(dl) x0, x1 = bb.intervalx + x0, x1 = mtransforms.nonsingular(x0, x1, increasing=False) if self._xmargin > 0: delta = (x1 - x0) * self._xmargin x0 -= delta x1 += delta + if not _tight: + x0, x1 = self.xaxis.get_major_locator().view_limits(x0, x1) + self.set_xbound(x0, x1) if scaley and self._autoscaleYon: yshared = self._shared_y_axes.get_siblings(self) dl = [ax.dataLim for ax in yshared] bb = mtransforms.BboxBase.union(dl) y0, y1 = bb.intervaly + y0, y1 = mtransforms.nonsingular(y0, y1, increasing=False) if self._ymargin > 0: delta = (y1 - y0) * self._ymargin y0 -= delta y1 += delta + if not _tight: + y0, y1 = self.yaxis.get_major_locator().view_limits(y0, y1) + self.set_ybound(y0, y1) - if tight is not None: - self._tight = bool(tight) - if (self._tight or (len(self.images)>0 and - len(self.lines)==0 and - len(self.patches)==0)): - if scalex and self._autoscaleXon: - self.set_xbound(x0, x1) - if scaley and self._autoscaleYon: - self.set_ybound(y0, y1) - return - - if scalex and self._autoscaleXon: - XL = self.xaxis.get_major_locator().view_limits(x0, x1) - self.set_xbound(XL) - if scaley and self._autoscaleYon: - YL = self.yaxis.get_major_locator().view_limits(y0, y1) - self.set_ybound(YL) - #### Drawing @allow_rasterization This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2010-04-22 08:27:26
|
Revision: 8267 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8267&view=rev Author: efiring Date: 2010-04-22 08:27:18 +0000 (Thu, 22 Apr 2010) Log Message: ----------- Axes.hist: remove unnecessary copying of input array. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2010-04-22 07:49:13 UTC (rev 8266) +++ trunk/matplotlib/lib/matplotlib/axes.py 2010-04-22 08:27:18 UTC (rev 8267) @@ -7289,17 +7289,16 @@ if isinstance(x, np.ndarray): # TODO: support masked arrays; - # Why is the copy needed? - x = np.array(x, copy=True, subok=False) + x = np.asarray(x) if x.ndim == 2: - x = x.T + x = x.T # 2-D input with columns as datasets; switch to rows elif x.ndim == 1: - x.shape = (1, x.shape[0]) + x = x.reshape(1, x.shape[0]) # new view, single row else: raise ValueError("x must be 1D or 2D") if x.shape[1] < x.shape[0]: - warnings.warn('2D hist input should be nsamples x nvariables; ' - 'this looks transposed') + warnings.warn('2D hist input should be nsamples x nvariables;\n ' + 'this looks transposed (shape is %d x %d)' % x.shape[::-1]) else: # multiple hist with data of different length x = [np.array(xi) for xi in x] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2010-04-23 18:33:57
|
Revision: 8268 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8268&view=rev Author: mdboom Date: 2010-04-23 18:33:51 +0000 (Fri, 23 Apr 2010) Log Message: ----------- Fix docstring formatting in imshow. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2010-04-22 08:27:18 UTC (rev 8267) +++ trunk/matplotlib/lib/matplotlib/axes.py 2010-04-23 18:33:51 UTC (rev 8268) @@ -6406,11 +6406,10 @@ *interpolation*: Acceptable values are *None*, 'nearest', 'bilinear', - 'bicubic', 'spline16', 'spline36', 'hanning', 'hamming', - 'hermite', 'kaiser', 'quadric', 'catrom', 'gaussian', - 'bessel', 'mitchell', 'sinc', 'lanczos', + 'bicubic', 'spline16', 'spline36', 'hanning', 'hamming', + 'hermite', 'kaiser', 'quadric', 'catrom', 'gaussian', + 'bessel', 'mitchell', 'sinc', 'lanczos' - If *interpolation* is *None*, default to rc ``image.interpolation``. See also the *filternorm* and *filterrad* parameters This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2010-04-26 21:11:10
|
Revision: 8274 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8274&view=rev Author: efiring Date: 2010-04-26 21:11:03 +0000 (Mon, 26 Apr 2010) Log Message: ----------- axes: set _tight default to False; restore previous nonsingular expander Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2010-04-26 20:37:14 UTC (rev 8273) +++ trunk/matplotlib/lib/matplotlib/axes.py 2010-04-26 21:11:03 UTC (rev 8274) @@ -838,7 +838,7 @@ self._autoscaleYon = True self._xmargin = 0 self._ymargin = 0 - self._tight = True + self._tight = False self._update_transScale() # needed? self._get_lines = _process_plot_var_args(self) @@ -1722,7 +1722,8 @@ dl = [ax.dataLim for ax in xshared] bb = mtransforms.BboxBase.union(dl) x0, x1 = bb.intervalx - x0, x1 = mtransforms.nonsingular(x0, x1, increasing=False) + x0, x1 = mtransforms.nonsingular(x0, x1, increasing=False, + expander=0.05) if self._xmargin > 0: delta = (x1 - x0) * self._xmargin x0 -= delta @@ -1736,7 +1737,8 @@ dl = [ax.dataLim for ax in yshared] bb = mtransforms.BboxBase.union(dl) y0, y1 = bb.intervaly - y0, y1 = mtransforms.nonsingular(y0, y1, increasing=False) + y0, y1 = mtransforms.nonsingular(y0, y1, increasing=False, + expander=0.05) if self._ymargin > 0: delta = (y1 - y0) * self._ymargin y0 -= delta This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2010-05-04 05:24:59
|
Revision: 8293 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8293&view=rev Author: efiring Date: 2010-05-04 05:24:53 +0000 (Tue, 04 May 2010) Log Message: ----------- hist: accept a list of scalars as equivalent to a 1-D ndarray Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2010-05-03 18:37:38 UTC (rev 8292) +++ trunk/matplotlib/lib/matplotlib/axes.py 2010-05-04 05:24:53 UTC (rev 8293) @@ -6187,7 +6187,7 @@ precise point of intersection. Otherwise, the start and end points of the filled region will only occur on explicit values in the *x* array. - + *kwargs* keyword args passed on to the :class:`PolyCollection` @@ -6254,13 +6254,13 @@ return x[ind-1], y1[ind-1] elif np.ma.is_masked(diff_values[0]): return x[ind], y1[ind] - + diff_order = diff_values.argsort() diff_root_x = np.interp( 0, diff_values[diff_order], x_values[diff_order]) diff_root_y = np.interp(diff_root_x, x_values, y1_values) return diff_root_x, diff_root_y - + start = get_interp_point(ind0) end = get_interp_point(ind1) else: @@ -6272,12 +6272,12 @@ X[0] = start X[N+1] = end - + 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) @@ -7328,7 +7328,7 @@ 'hist now uses the rwidth to give relative width ' 'and not absolute width') - if isinstance(x, np.ndarray): + if isinstance(x, np.ndarray) or not iterable(x[0]): # TODO: support masked arrays; x = np.asarray(x) if x.ndim == 2: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lee...@us...> - 2010-05-04 19:46:34
|
Revision: 8295 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8295&view=rev Author: leejjoon Date: 2010-05-04 19:46:28 +0000 (Tue, 04 May 2010) Log Message: ----------- Axes.annotate sets _remove_method Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2010-05-04 17:53:33 UTC (rev 8294) +++ trunk/matplotlib/lib/matplotlib/axes.py 2010-05-04 19:46:28 UTC (rev 8295) @@ -3033,6 +3033,7 @@ self._set_artist_props(a) if kwargs.has_key('clip_on'): a.set_clip_path(self.patch) self.texts.append(a) + a._remove_method = lambda h: self.texts.remove(h) return a #### Lines and spans This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ry...@us...> - 2010-05-09 02:59:36
|
Revision: 8301 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8301&view=rev Author: ryanmay Date: 2010-05-09 02:59:29 +0000 (Sun, 09 May 2010) Log Message: ----------- Clarify axes.scatter docstring slightly for using 'none' as a string instead of the None object. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2010-05-06 19:59:32 UTC (rev 8300) +++ trunk/matplotlib/lib/matplotlib/axes.py 2010-05-09 02:59:29 UTC (rev 8301) @@ -5424,10 +5424,10 @@ particular: *edgecolors*: - 'none' to plot faces with no outlines + The string 'none' to plot faces with no outlines *facecolors*: - 'none' to plot unfilled outlines + The string 'none' to plot unfilled outlines Here are the standard descriptions of all the :class:`~matplotlib.collections.Collection` kwargs: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2010-05-10 18:06:51
|
Revision: 8302 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8302&view=rev Author: mdboom Date: 2010-05-10 18:06:45 +0000 (Mon, 10 May 2010) Log Message: ----------- Fix aspect ratio calculation for polar plots. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2010-05-09 02:59:29 UTC (rev 8301) +++ trunk/matplotlib/lib/matplotlib/axes.py 2010-05-10 18:06:45 UTC (rev 8302) @@ -1084,20 +1084,23 @@ aspect = self.get_aspect() - xscale, yscale = self.get_xscale(), self.get_yscale() - if xscale == "linear" and yscale == "linear": + if self.name != 'polar': + xscale, yscale = self.get_xscale(), self.get_yscale() + if xscale == "linear" and yscale == "linear": + aspect_scale_mode = "linear" + elif xscale == "log" and yscale == "log": + aspect_scale_mode = "log" + elif (xscale == "linear" and yscale == "log") or \ + (xscale == "log" and yscale == "linear"): + if aspect is not "auto": + warnings.warn( + 'aspect is not supported for Axes with xscale=%s, yscale=%s' \ + % (xscale, yscale)) + aspect = "auto" + else: # some custom projections have their own scales. + pass + else: aspect_scale_mode = "linear" - elif xscale == "log" and yscale == "log": - aspect_scale_mode = "log" - elif (xscale == "linear" and yscale == "log") or \ - (xscale == "log" and yscale == "linear"): - if aspect is not "auto": - warnings.warn( - 'aspect is not supported for Axes with xscale=%s, yscale=%s' \ - % (xscale, yscale)) - aspect = "auto" - else: # some custom projections have their own scales. - pass if aspect == 'auto': self.set_position( position , which='active') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2010-05-10 20:34:42
|
Revision: 8306 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8306&view=rev Author: mdboom Date: 2010-05-10 20:34:33 +0000 (Mon, 10 May 2010) Log Message: ----------- [2998906] OverflowError when xscale='log' for hexbin Raises ValueError if trying to log-scale non-positive values. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2010-05-10 20:17:51 UTC (rev 8305) +++ trunk/matplotlib/lib/matplotlib/axes.py 2010-05-10 20:34:33 UTC (rev 8306) @@ -5778,8 +5778,12 @@ x = np.array(x, float) y = np.array(y, float) if xscale=='log': + if np.any(x <= 0.0): + raise ValueError("x contains non-positive values, so can not be log-scaled") x = np.log10(x) if yscale=='log': + if np.any(y <= 0.0): + raise ValueError("y contains non-positive values, so can not be log-scaled") y = np.log10(y) if extent is not None: xmin, xmax, ymin, ymax = extent This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lee...@us...> - 2010-05-18 17:14:47
|
Revision: 8318 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8318&view=rev Author: leejjoon Date: 2010-05-18 17:14:40 +0000 (Tue, 18 May 2010) Log Message: ----------- fix savefig bug Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2010-05-17 19:03:58 UTC (rev 8317) +++ trunk/matplotlib/lib/matplotlib/axes.py 2010-05-18 17:14:40 UTC (rev 8318) @@ -8002,7 +8002,7 @@ bb.extend([bby1, bby2]) - bb.extend([c.get_window_extent(renderer) for c in artists]) + bb.extend([c.get_window_extent(renderer) for c in artists if c.get_visible()]) _bbox = mtransforms.Bbox.union([b for b in bb if b.width!=0 or b.height!=0]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |