From 5a4be4cd18c9a12135e5792039ffcc974a0a7cc2 Mon Sep 17 00:00:00 2001 From: khyox Date: Fri, 6 May 2016 19:59:49 +0900 Subject: [PATCH 1/4] Correct ylabel in histogram_demo_features.py example --- examples/statistics/histogram_demo_features.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/statistics/histogram_demo_features.py b/examples/statistics/histogram_demo_features.py index 32c56cb81d4..681cb0f7e15 100644 --- a/examples/statistics/histogram_demo_features.py +++ b/examples/statistics/histogram_demo_features.py @@ -27,7 +27,7 @@ y = mlab.normpdf(bins, mu, sigma) plt.plot(bins, y, '--') plt.xlabel('Smarts') -plt.ylabel('Probability') +plt.ylabel('Probability density') plt.title(r'Histogram of IQ: $\mu=100$, $\sigma=15$') # Tweak spacing to prevent clipping of ylabel From f1d075b13a8f437d9cfa79b1ffb4388e63782876 Mon Sep 17 00:00:00 2001 From: khyox Date: Sun, 8 May 2016 18:00:39 +0900 Subject: [PATCH 2/4] Improve the doc of hist in pyplot Extend the description about the normed option for histograms (hist) to clarify which one of the two common ways to normalize the counts is available through this option and which is not. --- lib/matplotlib/axes/_axes.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 4f620ba3199..ab571187222 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -5801,9 +5801,11 @@ def hist(self, x, bins=None, range=None, normed=False, weights=None, normed : boolean, optional If `True`, the first element of the return tuple will be the counts normalized to form a probability density, i.e., - ``n/(len(x)`dbin)``, i.e., the integral of the histogram will sum - to 1. If *stacked* is also *True*, the sum of the histograms is - normalized to 1. + the integral of the histogram will sum to 1. So, the normalized + count *is not* the count in a bin divided by the total number + of observations, but it is the count in the bin divided by the + number of observations times the bin width. If `stacked` is + also `True`, the sum of the histograms is normalized to 1. Default is ``False`` From d6a8e5fd19bf4ab32ba2068c2092d451007cc574 Mon Sep 17 00:00:00 2001 From: khyox Date: Mon, 9 May 2016 10:00:26 +0900 Subject: [PATCH 3/4] Adjust some doc of hist in pyplot Tries to introduce the suggestions of Thomas in #6386. --- lib/matplotlib/axes/_axes.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index ab571187222..19a581d7b25 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -5801,11 +5801,11 @@ def hist(self, x, bins=None, range=None, normed=False, weights=None, normed : boolean, optional If `True`, the first element of the return tuple will be the counts normalized to form a probability density, i.e., - the integral of the histogram will sum to 1. So, the normalized - count *is not* the count in a bin divided by the total number - of observations, but it is the count in the bin divided by the - number of observations times the bin width. If `stacked` is - also `True`, the sum of the histograms is normalized to 1. + the area (or integral) under the histogram will sum to 1. + This is achieved dividing the count by the number of observations + times the bin width and *not* dividing by the total number + of observations. If `stacked` is also `True`, the sum of the + histograms is normalized to 1. Default is ``False`` From b8f52adf9ee500e09258e53abb9bafac2218c8fe Mon Sep 17 00:00:00 2001 From: khyox Date: Mon, 9 May 2016 21:38:50 +0900 Subject: [PATCH 4/4] Avoid trailing whitespace in comment in _axes.py Correct pep8 deviation in _axes.py:5807:73: W291 trailing whitespace --- lib/matplotlib/axes/_axes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 19a581d7b25..080f88a404c 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -5804,7 +5804,7 @@ def hist(self, x, bins=None, range=None, normed=False, weights=None, the area (or integral) under the histogram will sum to 1. This is achieved dividing the count by the number of observations times the bin width and *not* dividing by the total number - of observations. If `stacked` is also `True`, the sum of the + of observations. If `stacked` is also `True`, the sum of the histograms is normalized to 1. Default is ``False``