Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 728dc3f

Browse files
committed
fixed auto-legend wart for bar and friends
svn path=/trunk/matplotlib/; revision=5462
1 parent 885a244 commit 728dc3f

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

lib/matplotlib/axes.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5773,6 +5773,16 @@ def hist(self, x, bins=10, range=None, normed=False, cumulative=False,
57735773
#fig.savefig('histogram_demo',dpi=72)
57745774
plt.show()
57755775
5776+
5777+
You can use labels for your histogram, and only the first
5778+
Rectangle gets the label (the others get the magic string
5779+
'_nolegend_'. This will make the histograms work in the
5780+
intuitive way for bar charts::
5781+
5782+
ax.hist(10+2*np.random.randn(1000), label='men')
5783+
ax.hist(12+3*np.random.randn(1000), label='women', alpha=0.5)
5784+
ax.legend()
5785+
57765786
"""
57775787
if not self._hold: self.cla()
57785788

0 commit comments

Comments
 (0)