- Matplotlib でグラフプログラミング【Python】
224 :デフォルトの名無しさん[]:2016/10/11(火) 00:20:24.10 ID:7970w8cq - >>223 追加
聞いてばかりですみません、もう一つ聞きたいことがありまして ボタンを2つにした場合には fig.canvas.mpl_connectをどうつなげるべきなのでしょうか? class Index1(object): def __init__(self, ax): self.ax = ax def next(self, event): xdata = event.xdata ydata = event.ydata self.ax.plot(xdata, ydata, color="red", marker="o") plt.draw() def prev(self, event): xdata = event.xdata ydata = event.ydata self.ax.plot(xdata, ydata, color="blue", marker="o") plt.draw() axnext = plt.axes([0.81, 0.05, 0.1, 0.075]) axprev = plt.axes([0.11, 0.05, 0.1, 0.075]) fig.canvas.mpl_connect('button_press_event', Index(ax).???) bnext = Button(axnext, 'red') bnext.on_clicked(Index(ax).next) bnext = Button(axprev, 'blue') bnext.on_clicked(Index(ax).prev)
|