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

Skip to content

Commit e7ddffb

Browse files
committed
*Buttons: share self._buttons_xs
1 parent e046a98 commit e7ddffb

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

lib/matplotlib/widgets.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,7 @@ def __init__(self, ax, labels, *, useblit=True, label_props=None, **kwargs):
10571057

10581058
self._useblit = useblit
10591059

1060+
self._buttons_xs = [0.15] * len(labels)
10601061
self._buttons_ys = np.linspace(1, 0, len(labels)+2)[1:-1]
10611062

10621063
label_props = _expand_text_props(label_props)
@@ -1219,7 +1220,7 @@ def _init_props(self, text_size, actives, frame_props, check_props):
12191220
frame_props.setdefault('facecolor', frame_props.get('color', 'none'))
12201221
frame_props.setdefault('edgecolor', frame_props.pop('color', 'black'))
12211222
self._frames = self.ax.scatter(
1222-
[0.15] * len(self._buttons_ys),
1223+
self._buttons_xs,
12231224
self._buttons_ys,
12241225
**frame_props,
12251226
)
@@ -1236,7 +1237,7 @@ def _init_props(self, text_size, actives, frame_props, check_props):
12361237
}
12371238
check_props.setdefault('facecolor', check_props.pop('color', 'black'))
12381239
self._buttons = self.ax.scatter(
1239-
[0.15] * len(self._buttons_ys),
1240+
self._buttons_xs,
12401241
self._buttons_ys,
12411242
**check_props
12421243
)
@@ -1746,7 +1747,7 @@ def _init_props(self, text_size, active, activecolor, radio_props):
17461747
radio_props.setdefault('facecolor',
17471748
radio_props.pop('color', activecolor))
17481749
self._buttons = self.ax.scatter(
1749-
[.15] * len(self._buttons_ys),
1750+
self._buttons_xs,
17501751
self._buttons_ys,
17511752
**radio_props,
17521753
)

0 commit comments

Comments
 (0)