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

Skip to content

Commit 2e41cb5

Browse files
committed
update and fix docs
1 parent cb2d3d1 commit 2e41cb5

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

doc/users/next_whats_new/boxplot_legend_support.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Legend support for Boxplot
33
Boxplots now support a *label* parameter to create legend entries.
44

55
Legend labels can be passed as a list of strings to label multiple boxes in a single
6-
boxplot call:
6+
`.boxplot` call:
77

88

99
.. plot::
@@ -37,7 +37,7 @@ boxplot call:
3737
ax.legend()
3838

3939

40-
Or as a single string to each individual boxplot:
40+
Or as a single string to each individual `.boxplot`:
4141

4242
.. plot::
4343
:include-source: true

lib/matplotlib/axes/_axes.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3997,6 +3997,8 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
39973997
median line (``result["medians"]``); if *patch_artist* is True, the legend
39983998
will show the box `.Patch` artists (``result["boxes"]``) instead.
39993999
4000+
.. versionadded:: 3.9
4001+
40004002
data : indexable object, optional
40014003
DATA_PARAMETER_PLACEHOLDER
40024004
@@ -4221,6 +4223,8 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
42214223
median line (``result["medians"]``); if *patch_artist* is True, the legend
42224224
will show the box `.Patch` artists (``result["boxes"]``) instead.
42234225
4226+
.. versionadded:: 3.9
4227+
42244228
zorder : float, default: ``Line2D.zorder = 2``
42254229
The zorder of the resulting boxplot.
42264230
@@ -4421,8 +4425,7 @@ def do_patch(xs, ys, **kwargs):
44214425
box_or_med[0].set_label(label)
44224426
else: # label is a sequence
44234427
if len(box_or_med) != len(label):
4424-
raise ValueError("There must be an equal number of legend"
4425-
" labels and boxplots.")
4428+
raise ValueError(datashape_message.format("label"))
44264429
for artist, lbl in zip(box_or_med, label):
44274430
artist.set_label(lbl)
44284431

lib/matplotlib/axes/_axes.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ class Axes(_AxesBase):
372372
autorange: bool = ...,
373373
zorder: float | None = ...,
374374
capwidths: float | ArrayLike | None = ...,
375-
label: Sequence[str] | None = ...,
375+
label: Sequence[str] | None = ...,
376376
*,
377377
data=...,
378378
) -> dict[str, Any]: ...
@@ -398,7 +398,7 @@ class Axes(_AxesBase):
398398
manage_ticks: bool = ...,
399399
zorder: float | None = ...,
400400
capwidths: float | ArrayLike | None = ...,
401-
label: Sequence[str] | None = ...,
401+
label: Sequence[str] | None = ...,
402402
) -> dict[str, Any]: ...
403403
def scatter(
404404
self,

0 commit comments

Comments
 (0)