python - Matplotlib widget - many radiobuttons issue -
i need set height of matplotlib widget, change alignment or change font don't know how.
screenshots:
5 radio buttons: 
15 radio buttons: 
and here critical code part:
def evolvecallback_(self, notification): global stats={} results=[] fitnesses=[] code,fit in evolve(i): results.append(code) stats[str(fit)]=code fitnesses.append(str(fit)) i+=1 fig = plt.figure() done="" if found(): done=" - solution found!" print "done!" fig.canvas.set_window_title("generation "+str(i)+". - best migrating individuals"+done) ax = plt.subplot(111) ax.set_title(stats[str(fitnesses[0])]) l, = ax.plot(x, s0, lw=2, color='blue') plt.subplots_adjust(left=0.4) axcolor = 'lightgoldenrodyellow' rax = plt.axes([0.05, 0.7, 0.15, 0.15], axisbg=axcolor) radio = radiobuttons(rax, tuple(fitnesses)) def change(label): hzdict = {} x = np.arange(-5.0, 5.0, 0.01) j=0 in tuple(results): hzdict[fitnesses[j]]=eval(i) j+=1 ax.set_title(stats[str(label)]) ydata = hzdict[str(label)] l.set_ydata(ydata) plt.draw() radio.on_clicked(change) plt.show()
this line sets , how big axes radio buttons drawn onto is:
rax = plt.axes([0.05, 0.7, 0.15, 0.15], axisbg=axcolor) change like
rax = plt.axes([0.05, 0.3, 0.15, 0.5], axisbg=axcolor) to clear, rax axes object adding radio button widgets to.
Comments
Post a Comment