如何在 RadioButtons 小部件上获得较窄的宽度和较大的高度,并且仍然有不重叠的圆形单选按钮?
plt.figure()
rax = plt.axes([0.1, 0.1, 0.6, 0.6], frameon=True ,aspect='equal')
labels = [str(i) for i in range(10)]
radios = RadioButtons(rax, labels)
for circle in radios.circles: # adjust radius here. The default is 0.05
circle.set_radius(0.02)
plt.show()
上面的方法之所以有效,是因为它将轴实例的宽度和高度设置为 0.6,但我希望宽度为 0.1,高度为 0.6:
plt.figure()
rax = plt.axes([0.1, 0.1, 0.1, 0.6], frameon=True, aspect='equal')
labels = [str(i) for i in range(10)]
radios = RadioButtons(rax, labels)
for circle in radios.circles: # adjust radius here. The default is 0.05
circle.set_radius(0.02)
plt.show()
这只是使结果非常小,宽度为 0.1,高度为 0.1(我想是因为正在使用 aspect='equal'。如果我删除后者,我会得到:
我问的原因是这些单选按钮将是其右侧绘图的窄边栏。所以它应该是窄而高的。