Skip to content

Commit 43ce57d

Browse files
committed
Made suggested changes
1 parent 9a813f4 commit 43ce57d

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

doc/users/next_whats_new/histogram_vectorized_parameters.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
Vectorized ``hist`` style parameters
22
------------------------------------
33

4-
The parameters ``hatch``, ``edgecolor``, ``facecolor``, ``linewidth`` and ``linestyle``
4+
The parameters *hatch*, *edgecolor*, *facecolor*, *linewidth* and *linestyle*
55
of the `~matplotlib.axes.Axes.hist` method are now vectorized.
66
This means that you can pass in individual parameters for each histogram
77
when the input *x* has multiple datasets.
88

99

1010
.. plot::
1111
:include-source: true
12-
:alt: Four charts, each displaying stacked histograms of three Poisson distributions. Each chart differentiates the histograms using various parameters: ax1 uses different linewidths, ax2 uses different hatches, ax3 uses different edgecolors, and ax4 uses different facecolors. Each histogram in ax1 and ax3 also has a different edgecolor.
12+
:alt: Four charts, each displaying stacked histograms of three Poisson distributions. Each chart differentiates the histograms using various parameters: top left uses different linewidths, top right uses different hatches, bottom left uses different edgecolors, and bottom right uses different facecolors. Each histogram on the left side also has a different edgecolor.
1313

1414
import matplotlib.pyplot as plt
1515
import numpy as np

galleries/examples/statistics/histogram_multihist.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
#
6262
#
6363
# edgecolor
64-
# ...........................
64+
# .........
6565

6666
fig, ax = plt.subplots()
6767

@@ -76,7 +76,7 @@
7676

7777
# %%
7878
# facecolor
79-
# ...........................
79+
# .........
8080

8181
fig, ax = plt.subplots()
8282

@@ -90,7 +90,7 @@
9090

9191
# %%
9292
# hatch
93-
# .......................
93+
# .....
9494

9595
fig, ax = plt.subplots()
9696

@@ -104,7 +104,7 @@
104104

105105
# %%
106106
# linewidth
107-
# ..........................
107+
# .........
108108

109109
fig, ax = plt.subplots()
110110

@@ -120,7 +120,7 @@
120120

121121
# %%
122122
# linestyle
123-
# ..........................
123+
# .........
124124

125125
fig, ax = plt.subplots()
126126

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6940,9 +6940,10 @@ def hist(self, x, bins=None, range=None, density=False, weights=None,
69406940
`~matplotlib.patches.Patch` properties. The following properties
69416941
additionally accept a sequence of values corresponding to the
69426942
datasets in *x*:
6943-
*edgecolors*, *facecolors*, *linewidths*, *linestyles*, *hatches*.
6943+
*edgecolors*, *facecolors*, *lines*, *linestyles*, *hatches*.
69446944
69456945
.. versionadded:: 3.10
6946+
Allowing sequences of values in above listed Patch properties.
69466947
69476948
See Also
69486949
--------

lib/matplotlib/tests/test_axes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4627,6 +4627,10 @@ def test_hist_vectorized_params(fig_test, fig_ref, kwargs):
46274627

46284628

46294629
@pytest.mark.parametrize('kwargs, patch_face, patch_edge',
4630+
# 'C0'(blue) stands for the first color of the
4631+
# default color cycle as well as the patch.facecolor rcParam
4632+
# When the expected edgecolor is 'k'(black),
4633+
# it corresponds to the patch.edgecolor rcParam
46304634
[({'histtype': 'stepfilled', 'color': 'r',
46314635
'facecolor': 'y', 'edgecolor': 'g'}, 'y', 'g'),
46324636
({'histtype': 'step', 'color': 'r',
@@ -4653,10 +4657,6 @@ def test_hist_vectorized_params(fig_test, fig_ref, kwargs):
46534657
({'histtype': 'step'}, ('C0', 0), 'C0')])
46544658
def test_hist_color_semantics(kwargs, patch_face, patch_edge):
46554659
_, _, patches = plt.figure().subplots().hist([1, 2, 3], **kwargs)
4656-
# 'C0'(blue) stands for the first color of the default color cycle
4657-
# as well as the patch.facecolor rcParam
4658-
# When the expected edgecolor is 'k'(black), it corresponds to the
4659-
# patch.edgecolor rcParam
46604660
assert all(mcolors.same_color([p.get_facecolor(), p.get_edgecolor()],
46614661
[patch_face, patch_edge]) for p in patches)
46624662

0 commit comments

Comments
 (0)