@@ -1596,7 +1596,7 @@ class RadioButtons(AxesWidget):
1596
1596
The label text of the currently selected button.
1597
1597
"""
1598
1598
1599
- def __init__ (self , ax , labels , active = 0 , activecolor = 'blue' , * ,
1599
+ def __init__ (self , ax , labels , active = 0 , activecolor = None , * ,
1600
1600
useblit = True , label_props = None , radio_props = None ):
1601
1601
"""
1602
1602
Add radio buttons to an `~.axes.Axes`.
@@ -1610,12 +1610,8 @@ def __init__(self, ax, labels, active=0, activecolor='blue', *,
1610
1610
active : int
1611
1611
The index of the initially selected button.
1612
1612
activecolor : color
1613
- The color of the selected button.
1614
-
1615
- .. note::
1616
- If a facecolor is supplied in *radio_props*, it will override
1617
- *activecolor*. This may be used to provide an active color per
1618
- button.
1613
+ The color of the selected button. The default is ``'blue'`` if not
1614
+ specified here or in *radio_props*.
1619
1615
useblit : bool, default: True
1620
1616
Use blitting for faster drawing if supported by the backend.
1621
1617
See the tutorial :doc:`/tutorials/advanced/blitting` for details.
@@ -1632,6 +1628,21 @@ def __init__(self, ax, labels, active=0, activecolor='blue', *,
1632
1628
button.
1633
1629
"""
1634
1630
super ().__init__ (ax )
1631
+
1632
+ _api .check_isinstance ((dict , None ), label_props = label_props ,
1633
+ radio_props = radio_props )
1634
+
1635
+ radio_props = cbook .normalize_kwargs (radio_props ,
1636
+ collections .PathCollection )
1637
+ if activecolor is not None :
1638
+ if 'facecolor' in radio_props :
1639
+ _api .warn_external (
1640
+ 'Both the *activecolor* parameter and the *facecolor* '
1641
+ 'key in the *radio_props* parameter has been specified. '
1642
+ '*activecolor* will be ignored.' )
1643
+ else :
1644
+ activecolor = 'blue' # Default.
1645
+
1635
1646
self .activecolor = activecolor
1636
1647
self .value_selected = labels [active ]
1637
1648
@@ -1644,9 +1655,6 @@ def __init__(self, ax, labels, active=0, activecolor='blue', *,
1644
1655
self ._useblit = useblit and self .canvas .supports_blit
1645
1656
self ._background = None
1646
1657
1647
- _api .check_isinstance ((dict , None ), label_props = label_props ,
1648
- radio_props = radio_props )
1649
-
1650
1658
label_props = _expand_text_props (label_props )
1651
1659
self .labels = [
1652
1660
ax .text (0.25 , y , label , transform = ax .transAxes ,
@@ -1660,7 +1668,7 @@ def __init__(self, ax, labels, active=0, activecolor='blue', *,
1660
1668
's' : text_size ** 2 ,
1661
1669
'facecolor' : activecolor ,
1662
1670
'edgecolor' : 'black' ,
1663
- ** cbook . normalize_kwargs ( radio_props , collections . PathCollection ) ,
1671
+ ** radio_props ,
1664
1672
'transform' : ax .transAxes ,
1665
1673
'animated' : self ._useblit ,
1666
1674
}
0 commit comments