Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 71de0a9

Browse files
dstansbymeeseeksmachine
authored andcommitted
Backport PR matplotlib#30412: {Check,Radio}Buttons: Improve docs of label_props
1 parent 10fb34c commit 71de0a9

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

‎lib/matplotlib/widgets.py‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,8 +1010,11 @@ def __init__(self, ax, labels, actives=None, *, useblit=True,
10101010
10111011
.. versionadded:: 3.7
10121012
1013-
label_props : dict, optional
1014-
Dictionary of `.Text` properties to be used for the labels.
1013+
label_props : dict of lists, optional
1014+
Dictionary of `.Text` properties to be used for the labels. Each
1015+
dictionary value should be a list of at least a single element. If
1016+
the list is of length M, its values are cycled such that the Nth
1017+
label gets the (N mod M) property.
10151018
10161019
.. versionadded:: 3.7
10171020
frame_props : dict, optional
@@ -1111,7 +1114,8 @@ def set_label_props(self, props):
11111114
Parameters
11121115
----------
11131116
props : dict
1114-
Dictionary of `.Text` properties to be used for the labels.
1117+
Dictionary of `.Text` properties to be used for the labels. Same
1118+
format as label_props argument of :class:`CheckButtons`.
11151119
"""
11161120
_api.check_isinstance(dict, props=props)
11171121
props = _expand_text_props(props)
@@ -1579,8 +1583,11 @@ def __init__(self, ax, labels, active=0, activecolor=None, *,
15791583
15801584
.. versionadded:: 3.7
15811585
1582-
label_props : dict or list of dict, optional
1583-
Dictionary of `.Text` properties to be used for the labels.
1586+
label_props : dict of lists, optional
1587+
Dictionary of `.Text` properties to be used for the labels. Each
1588+
dictionary value should be a list of at least a single element. If
1589+
the list is of length M, its values are cycled such that the Nth
1590+
label gets the (N mod M) property.
15841591
15851592
.. versionadded:: 3.7
15861593
radio_props : dict, optional
@@ -1689,7 +1696,8 @@ def set_label_props(self, props):
16891696
Parameters
16901697
----------
16911698
props : dict
1692-
Dictionary of `.Text` properties to be used for the labels.
1699+
Dictionary of `.Text` properties to be used for the labels. Same
1700+
format as label_props argument of :class:`RadioButtons`.
16931701
"""
16941702
_api.check_isinstance(dict, props=props)
16951703
props = _expand_text_props(props)

‎lib/matplotlib/widgets.pyi‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,11 @@ class CheckButtons(AxesWidget):
154154
actives: Iterable[bool] | None = ...,
155155
*,
156156
useblit: bool = ...,
157-
label_props: dict[str, Any] | None = ...,
157+
label_props: dict[str, Sequence[Any]] | None = ...,
158158
frame_props: dict[str, Any] | None = ...,
159159
check_props: dict[str, Any] | None = ...,
160160
) -> None: ...
161-
def set_label_props(self, props: dict[str, Any]) -> None: ...
161+
def set_label_props(self, props: dict[str, Sequence[Any]]) -> None: ...
162162
def set_frame_props(self, props: dict[str, Any]) -> None: ...
163163
def set_check_props(self, props: dict[str, Any]) -> None: ...
164164
def set_active(self, index: int, state: bool | None = ...) -> None: ... # type: ignore[override]
@@ -208,10 +208,10 @@ class RadioButtons(AxesWidget):
208208
activecolor: ColorType | None = ...,
209209
*,
210210
useblit: bool = ...,
211-
label_props: dict[str, Any] |Sequence[dict[str, Any]] | None = ...,
211+
label_props: dict[str, Sequence[Any]] | None = ...,
212212
radio_props: dict[str, Any] | None = ...,
213213
) -> None: ...
214-
def set_label_props(self, props: dict[str, Any]) -> None: ...
214+
def set_label_props(self, props: dict[str, Sequence[Any]]) -> None: ...
215215
def set_radio_props(self, props: dict[str, Any]) -> None: ...
216216
def set_active(self, index: int) -> None: ...
217217
def clear(self) -> None: ...

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /