@@ -1587,7 +1587,7 @@ class RadioButtons(AxesWidget):
15871587 The label text of the currently selected button.
15881588 """
15891589
1590- def __init__ (self , ax , labels , active = 0 , activecolor = 'blue' , * ,
1590+ def __init__ (self , ax , labels , active = 0 , activecolor = None , * ,
15911591 useblit = True , label_props = None , radio_props = None ):
15921592 """
15931593 Add radio buttons to an `~.axes.Axes`.
@@ -1601,12 +1601,8 @@ def __init__(self, ax, labels, active=0, activecolor='blue', *,
16011601 active : int
16021602 The index of the initially selected button.
16031603 activecolor : color
1604- The color of the selected button.
1605-
1606- .. note::
1607- If a facecolor is supplied in *radio_props*, it will override
1608- *activecolor*. This may be used to provide an active color per
1609- button.
1604+ The color of the selected button. The default is ``'blue'`` if not
1605+ specified here or in *radio_props*.
16101606 useblit : bool, default: True
16111607 Use blitting for faster drawing if supported by the backend.
16121608 See the tutorial :doc:`/tutorials/advanced/blitting` for details.
@@ -1623,6 +1619,21 @@ def __init__(self, ax, labels, active=0, activecolor='blue', *,
16231619 button.
16241620 """
16251621 super ().__init__ (ax )
1622+
1623+ _api .check_isinstance ((dict , None ), label_props = label_props ,
1624+ radio_props = radio_props )
1625+
1626+ radio_props = cbook .normalize_kwargs (radio_props ,
1627+ collections .PathCollection )
1628+ if activecolor is not None :
1629+ if 'facecolor' in radio_props :
1630+ _api .warn_external (
1631+ 'Both the *activecolor* parameter and the *facecolor* '
1632+ 'key in the *radio_props* parameter has been specified. '
1633+ '*activecolor* will be ignored.' )
1634+ else :
1635+ activecolor = 'blue' # Default.
1636+
16261637 self .activecolor = activecolor
16271638 self .value_selected = labels [active ]
16281639
@@ -1635,9 +1646,6 @@ def __init__(self, ax, labels, active=0, activecolor='blue', *,
16351646 self ._useblit = useblit and self .canvas .supports_blit
16361647 self ._background = None
16371648
1638- _api .check_isinstance ((dict , None ), label_props = label_props ,
1639- radio_props = radio_props )
1640-
16411649 label_props = _expand_text_props (label_props )
16421650 self .labels = [
16431651 ax .text (0.25 , y , label , transform = ax .transAxes ,
@@ -1648,7 +1656,7 @@ def __init__(self, ax, labels, active=0, activecolor='blue', *,
16481656
16491657 radio_props = {
16501658 's' : text_size ** 2 ,
1651- ** cbook . normalize_kwargs ( radio_props , collections . PathCollection ) ,
1659+ ** radio_props ,
16521660 'marker' : 'o' ,
16531661 'transform' : ax .transAxes ,
16541662 'animated' : self ._useblit ,
0 commit comments