A GUI neutral radio button. For the buttons to remain responsive you must keep a reference to this object. Connect to the RadioButtons with the `~._Buttons.on_clicked` method. Attributes ---------- ax : `~matplotlib.axes.Axes` The parent Axes for the widget.
| 1755 | |
| 1756 | |
| 1757 | class RadioButtons(_Buttons): |
| 1758 | """ |
| 1759 | A GUI neutral radio button. |
| 1760 | |
| 1761 | For the buttons to remain responsive you must keep a reference to this |
| 1762 | object. |
| 1763 | |
| 1764 | Connect to the RadioButtons with the `~._Buttons.on_clicked` method. |
| 1765 | |
| 1766 | Attributes |
| 1767 | ---------- |
| 1768 | ax : `~matplotlib.axes.Axes` |
| 1769 | The parent Axes for the widget. |
| 1770 | activecolor : :mpltype:`color` |
| 1771 | The color of the selected button. |
| 1772 | labels : list of `.Text` |
| 1773 | The button labels. |
| 1774 | value_selected : str |
| 1775 | The label text of the currently selected button. |
| 1776 | index_selected : int |
| 1777 | The index of the selected button. |
| 1778 | """ |
| 1779 | |
| 1780 | def __init__(self, ax, labels, active=0, activecolor=None, *, layout=None, |
| 1781 | useblit=True, label_props=None, radio_props=None): |
| 1782 | """ |
| 1783 | Add radio buttons to an `~.axes.Axes`. |
| 1784 | |
| 1785 | Parameters |
| 1786 | ---------- |
| 1787 | ax : `~matplotlib.axes.Axes` |
| 1788 | The Axes to add the buttons to. |
| 1789 | labels : list of str |
| 1790 | The button labels. |
| 1791 | active : int |
| 1792 | The index of the initially selected button. |
| 1793 | activecolor : :mpltype:`color` |
| 1794 | The color of the selected button. The default is ``'blue'`` if not |
| 1795 | specified here or in *radio_props*. |
| 1796 | layout : None or "vertical" or "horizontal" or (int, int), default: None |
| 1797 | The layout of the radio buttons. Options are: |
| 1798 | |
| 1799 | - ``None``: Use legacy vertical layout (default). |
| 1800 | - ``"vertical"``: Arrange buttons in a single column with |
| 1801 | dynamic positioning based on text widths. |
| 1802 | - ``"horizontal"``: Arrange buttons in a single row with |
| 1803 | dynamic positioning based on text widths. |
| 1804 | - ``(rows, cols)`` tuple: Arrange buttons in a grid with the |
| 1805 | specified number of rows and columns. Buttons are placed |
| 1806 | left-to-right, top-to-bottom with dynamic positioning. |
| 1807 | |
| 1808 | The layout options "vertical", "horizontal" and ``(rows, cols)`` |
| 1809 | create ``mtext.Text`` objects to determine exact text sizes, and |
| 1810 | then they are added to the Axes. This is usually okay, but may cause |
| 1811 | side-effects and has a slight performance impact. Therefore the |
| 1812 | default ``None`` value avoids this. |
| 1813 | |
| 1814 | .. admonition:: Provisional |
no outgoing calls
searching dependent graphs…