|
9 | 9 | which is flexible and helpful, but can also lead to confusion. In particular,
|
10 | 10 | you can:
|
11 | 11 |
|
12 |
| - - bin the data as you want, either with an automatically chosen number of |
13 |
| - bins, or with fixed bin edges, |
14 |
| - - normalize the histogram so that its integral is one, |
15 |
| - - and assign weights to the data points, so that each data point affects the |
16 |
| - count in its bin differently. |
| 12 | +- bin the data as you want, either with an automatically chosen number of |
| 13 | + bins, or with fixed bin edges, |
| 14 | +- normalize the histogram so that its integral is one, |
| 15 | +- and assign weights to the data points, so that each data point affects the |
| 16 | + count in its bin differently. |
17 | 17 |
|
18 | 18 | The Matplotlib ``hist`` method calls `numpy.histogram` and plots the results,
|
19 | 19 | therefore users should consult the numpy documentation for a definitive guide.
|
|
92 | 92 | # %%
|
93 | 93 | # This normalization can be a little hard to interpret when just exploring the
|
94 | 94 | # data. The value attached to each bar is divided by the total number of data
|
95 |
| -# points _and_ the width of the bin, and thus the values _integrate_ to one |
| 95 | +# points *and* the width of the bin, and thus the values _integrate_ to one |
96 | 96 | # when integrating across the full range of data.
|
97 |
| -# e.g. (``density = counts / (sum(counts) * np.diff(bins))``), |
98 |
| -# and (``np.sum(density * np.diff(bins)) == 1``). |
| 97 | +# e.g. :: |
| 98 | +# |
| 99 | +# (``density = counts / (sum(counts) * np.diff(bins))``) |
| 100 | +# (``np.sum(density * np.diff(bins)) == 1``). |
99 | 101 | #
|
100 | 102 | # This normalization is how `probability density functions
|
101 | 103 | # <https://en.wikipedia.org/wiki/Probability_density_function>`_ are defined in
|
|
0 commit comments