From: <jd...@us...> - 2008-06-10 15:51:51
|
Revision: 5461 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5461&view=rev Author: jdh2358 Date: 2008-06-10 08:50:55 -0700 (Tue, 10 Jun 2008) Log Message: ----------- fixed auto-legend wart for bar and friends Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-06-10 15:35:13 UTC (rev 5460) +++ trunk/matplotlib/CHANGELOG 2008-06-10 15:50:55 UTC (rev 5461) @@ -1,3 +1,7 @@ +2008-06-10 Bar now applies the label only to the frist patch, and + sets _nolegend_ for the other patch labels. This let's + autolegend work as expected for hist and bar + 2008-06-10 Fix text baseline alignment bug. [ 1985420 ] Repair of baseline alignment in Text._get_layout. Thanks Stan West - MGD Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008-06-10 15:35:13 UTC (rev 5460) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008-06-10 15:50:55 UTC (rev 5461) @@ -3530,6 +3530,7 @@ """ if not self._hold: self.cla() + label = kwargs.pop('label', '') def make_iterable(x): if not iterable(x): return [x] @@ -3667,8 +3668,11 @@ facecolor=c, edgecolor=e, linewidth=lw, + label=label ) + label = '_nolegend_' r.update(kwargs) + #print r.get_label(), label, 'label' in kwargs self.add_patch(r) patches.append(r) @@ -5673,10 +5677,10 @@ is an integer input argument=numbins, numbins+1 bin edges will be returned, compatabile with the semantics of np.histogram with the new=True argument. - + range: The lower and upper range of the bins. Lower and upper outliers - are ignored. If not provided, range is (x.min(), x.max()). + are ignored. If not provided, range is (x.min(), x.max()). normed: if True, the first element of the return tuple will @@ -5925,9 +5929,15 @@ else: raise ValueError, 'invalid histtype: %s' % histtype + label = kwargs.pop('label', '') + for patch in patches: for p in patch: p.update(kwargs) + p.set_label(label) + label = '_nolegend' + + if len(n)==1: return n[0], bins, cbook.silent_list('Patch', patches[0]) else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |