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

Skip to content

Commit 443ec06

Browse files
authored
Merge pull request matplotlib#30412 from doronbehar/_Buttons--label_props.doc
{Check,Radio}Buttons: Improve docs of label_props
2 parents e775274 + 2e10b79 commit 443ec06

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
@@ -1025,8 +1025,11 @@ def __init__(self, ax, labels, actives=None, *, useblit=True,
10251025
10261026
.. versionadded:: 3.7
10271027
1028-
label_props : dict, optional
1029-
Dictionary of `.Text` properties to be used for the labels.
1028+
label_props : dict of lists, optional
1029+
Dictionary of `.Text` properties to be used for the labels. Each
1030+
dictionary value should be a list of at least a single element. If
1031+
the list is of length M, its values are cycled such that the Nth
1032+
label gets the (N mod M) property.
10301033
10311034
.. versionadded:: 3.7
10321035
frame_props : dict, optional
@@ -1126,7 +1129,8 @@ def set_label_props(self, props):
11261129
Parameters
11271130
----------
11281131
props : dict
1129-
Dictionary of `.Text` properties to be used for the labels.
1132+
Dictionary of `.Text` properties to be used for the labels. Same
1133+
format as label_props argument of :class:`CheckButtons`.
11301134
"""
11311135
_api.check_isinstance(dict, props=props)
11321136
props = _expand_text_props(props)
@@ -1594,8 +1598,11 @@ def __init__(self, ax, labels, active=0, activecolor=None, *,
15941598
15951599
.. versionadded:: 3.7
15961600
1597-
label_props : dict or list of dict, optional
1598-
Dictionary of `.Text` properties to be used for the labels.
1601+
label_props : dict of lists, optional
1602+
Dictionary of `.Text` properties to be used for the labels. Each
1603+
dictionary value should be a list of at least a single element. If
1604+
the list is of length M, its values are cycled such that the Nth
1605+
label gets the (N mod M) property.
15991606
16001607
.. versionadded:: 3.7
16011608
radio_props : dict, optional
@@ -1704,7 +1711,8 @@ def set_label_props(self, props):
17041711
Parameters
17051712
----------
17061713
props : dict
1707-
Dictionary of `.Text` properties to be used for the labels.
1714+
Dictionary of `.Text` properties to be used for the labels. Same
1715+
format as label_props argument of :class:`RadioButtons`.
17081716
"""
17091717
_api.check_isinstance(dict, props=props)
17101718
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)