@@ -1584,7 +1584,7 @@ class RadioButtons(AxesWidget):
1584
1584
The label text of the currently selected button.
1585
1585
"""
1586
1586
1587
- def __init__ (self , ax , labels , active = 0 , activecolor = 'blue' , * ,
1587
+ def __init__ (self , ax , labels , active = 0 , activecolor = None , * ,
1588
1588
useblit = True , label_props = None , radio_props = None ):
1589
1589
"""
1590
1590
Add radio buttons to an `~.axes.Axes`.
@@ -1598,12 +1598,8 @@ def __init__(self, ax, labels, active=0, activecolor='blue', *,
1598
1598
active : int
1599
1599
The index of the initially selected button.
1600
1600
activecolor : color
1601
- The color of the selected button.
1602
-
1603
- .. note::
1604
- If a facecolor is supplied in *radio_props*, it will override
1605
- *activecolor*. This may be used to provide an active color per
1606
- button.
1601
+ The color of the selected button. The default is ``'blue'`` if not
1602
+ specified here or in *radio_props*.
1607
1603
useblit : bool, default: True
1608
1604
Use blitting for faster drawing if supported by the backend.
1609
1605
See the tutorial :doc:`/tutorials/advanced/blitting` for details.
@@ -1620,6 +1616,18 @@ def __init__(self, ax, labels, active=0, activecolor='blue', *,
1620
1616
button.
1621
1617
"""
1622
1618
super ().__init__ (ax )
1619
+
1620
+ radio_props = cbook .normalize_kwargs (radio_props ,
1621
+ collections .PathCollection )
1622
+ if activecolor is not None :
1623
+ if 'facecolor' in radio_props :
1624
+ _api .warn_external (
1625
+ 'Both the *activecolor* parameter and the *facecolor* '
1626
+ 'key in the *radio_props* parameter has been specified. '
1627
+ '*activecolor* will be ignored.' )
1628
+ else :
1629
+ activecolor = 'blue' # Default.
1630
+
1623
1631
self .activecolor = activecolor
1624
1632
self .value_selected = labels [active ]
1625
1633
@@ -1645,7 +1653,7 @@ def __init__(self, ax, labels, active=0, activecolor='blue', *,
1645
1653
's' : text_size ** 2 ,
1646
1654
'facecolor' : activecolor ,
1647
1655
'edgecolor' : 'black' ,
1648
- ** cbook . normalize_kwargs ( radio_props , collections . PathCollection ) ,
1656
+ ** radio_props ,
1649
1657
'transform' : ax .transAxes ,
1650
1658
'animated' : self ._useblit ,
1651
1659
}
0 commit comments