Add check buttons to `~.axes.Axes` instance *ax*. Parameters ---------- ax : `~matplotlib.axes.Axes` The parent Axes for the widget. labels : list of str The labels of the check buttons. actives : list of bool, optional
(self, ax, labels, actives=None, *, layout=None, useblit=True,
label_props=None, frame_props=None, check_props=None)
| 1248 | """ |
| 1249 | |
| 1250 | def __init__(self, ax, labels, actives=None, *, layout=None, useblit=True, |
| 1251 | label_props=None, frame_props=None, check_props=None): |
| 1252 | """ |
| 1253 | Add check buttons to `~.axes.Axes` instance *ax*. |
| 1254 | |
| 1255 | Parameters |
| 1256 | ---------- |
| 1257 | ax : `~matplotlib.axes.Axes` |
| 1258 | The parent Axes for the widget. |
| 1259 | labels : list of str |
| 1260 | The labels of the check buttons. |
| 1261 | actives : list of bool, optional |
| 1262 | The initial check states of the buttons. The list must have the |
| 1263 | same length as *labels*. If not given, all buttons are unchecked. |
| 1264 | layout : None or "vertical" or "horizontal" or (int, int), default: None |
| 1265 | The layout of the check buttons. Options are: |
| 1266 | |
| 1267 | - ``None``: Use legacy vertical layout (default). |
| 1268 | - ``"vertical"``: Arrange buttons in a single column with |
| 1269 | dynamic positioning based on text widths. |
| 1270 | - ``"horizontal"``: Arrange buttons in a single row with |
| 1271 | dynamic positioning based on text widths. |
| 1272 | - ``(rows, cols)`` tuple: Arrange buttons in a grid with the |
| 1273 | specified number of rows and columns. Buttons are placed |
| 1274 | left-to-right, top-to-bottom with dynamic positioning. |
| 1275 | |
| 1276 | The layout options "vertical", "horizontal" and ``(rows, cols)`` |
| 1277 | create ``mtext.Text`` objects to determine exact text sizes, and |
| 1278 | then they are added to the Axes. This is usually okay, but may cause |
| 1279 | side-effects and has a slight performance impact. Therefore the |
| 1280 | default ``None`` value avoids this. |
| 1281 | |
| 1282 | .. admonition:: Provisional |
| 1283 | The new layout options are provisional. Their algorithmic |
| 1284 | behavior, including the exact positions of buttons and labels, |
| 1285 | may still change without prior warning. |
| 1286 | |
| 1287 | .. versionadded:: 3.11 |
| 1288 | useblit : bool, default: True |
| 1289 | Use blitting for faster drawing if supported by the backend. |
| 1290 | See the tutorial :ref:`blitting` for details. |
| 1291 | |
| 1292 | .. versionadded:: 3.7 |
| 1293 | |
| 1294 | label_props : dict of lists, optional |
| 1295 | Dictionary of `.Text` properties to be used for the labels. Each |
| 1296 | dictionary value should be a list of at least a single element. If |
| 1297 | the list is of length M, its values are cycled such that the Nth |
| 1298 | label gets the (N mod M) property. |
| 1299 | |
| 1300 | .. versionadded:: 3.7 |
| 1301 | frame_props : dict, optional |
| 1302 | Dictionary of scatter `.Collection` properties to be used for the |
| 1303 | check button frame. Defaults (label font size / 2)**2 size, black |
| 1304 | edgecolor, no facecolor, and 1.0 linewidth. |
| 1305 | |
| 1306 | .. versionadded:: 3.7 |
| 1307 | check_props : dict, optional |