I wanted the sizes of radion button axes proportional to the number of radio buttons options (30, 20 and 10 in my example), like on my "without 'equal'" screenshot and round radiobutton circles, like on my "with 'equal'" screenshot. How do I get both right?
In more detail: I have RadioButtons widgets on a plot, and I wanted them to
- to have axes sizes defined using a formula (as opposed to being entered manually for each radiobutton group);
- to have circular (as opposed to elliptic) circles and also the sizes proportional to the number of options, so that they look nice.
Using this question, I can achieve the circular shape of the circles. But it completely changes the sizes of the axes.
import matplotlib.pyplot as plt
from matplotlib.widgets import RadioButtons
plt.rcParams.update({'font.size': 30})
rb_options = ['opt'+str(k) for k in range(30)]
switcher_sides = {}
raxs = []
fig = plt.figure()
fig.set_dpi(75)
fig.set_size_inches(15, 15)
for c, side in enumerate(['left', 'centre', 'right']):
rax_left = c * 0.3
# [left, bottom, width, height]
raxs.append(plt.axes([rax_left, 0, 0.3, (3-c)/3], aspect='equal')) #
switcher_sides[side] = RadioButtons(raxs[-1], rb_options[:(3-c)*10], active=5)
for circle in switcher_sides[side].circles: # adjust radius here. The default is 0.05
circle.set_radius(0.03)
plt.show()