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