2ちゃんねる スマホ用 ■掲示板に戻る■ 全部 1- 最新50    

Matplotlib でグラフプログラミング【Python】

223 :デフォルトの名無しさん:2016/10/11(火) 00:20:24.10 ID:7970w8cq.net
>>222 追加
聞いてばかりですみません、もう一つ聞きたいことがありまして
ボタンを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)

79 KB
新着レスの表示

掲示板に戻る 全部 前100 次100 最新50
名前: E-mail (省略可) :

read.cgi ver 2014.07.20.01.SC 2014/07/20 D ★