@@ -1164,6 +1164,29 @@ def test_radio_buttons_props(fig_test, fig_ref):
11641164 cb .set_radio_props ({** radio_props , 's' : (24 / 2 )** 2 })
11651165
11661166
1167+ @image_comparison (['check_radio_grid_buttons.png' ], style = 'mpl20' , remove_text = True )
1168+ def test_radio_grid_buttons ():
1169+ fig = plt .figure ()
1170+ rb_horizontal = widgets .RadioButtons (
1171+ fig .add_axes ((0.1 , 0.05 , 0.65 , 0.05 )),
1172+ ["tea" , "coffee" , "chocolate milk" , "water" , "soda" , "coke" ],
1173+ layout = 'horizontal' ,
1174+ active = 4 ,
1175+ )
1176+ cb_grid = widgets .CheckButtons (
1177+ fig .add_axes ((0.1 , 0.15 , 0.25 , 0.05 * 3 )),
1178+ ["Chicken" , "Salad" , "Rice" , "Sushi" , "Pizza" , "Fries" ],
1179+ layout = (3 , 2 ),
1180+ actives = [True , True , False , False , False , True ],
1181+ )
1182+ rb_vertical = widgets .RadioButtons (
1183+ fig .add_axes ((0.1 , 0.35 , 0.2 , 0.05 * 4 )),
1184+ ["Trinity Cream" , "Cake" , "Ice Cream" , "Muhallebi" ],
1185+ layout = 'vertical' ,
1186+ active = 3 ,
1187+ )
1188+
1189+
11671190def test_radio_button_active_conflict (ax ):
11681191 with pytest .warns (UserWarning ,
11691192 match = r'Both the \*activecolor\* parameter' ):
@@ -1229,8 +1252,7 @@ def test__buttons_callbacks(ax, widget):
12291252 "button_press_event" ,
12301253 ax ,
12311254 ax .transData .inverted ().transform (ax .transAxes .transform (
1232- # (x, y) of the 0th button defined at
1233- # `{Check,Radio}Buttons._init_props`
1255+ # (x, y) of the 0th button defined at `_Buttons._init_layout`
12341256 (0.15 , 0.5 ),
12351257 )),
12361258 1 ,
0 commit comments