5
http://goo.gl/J802b0의 코드 스 니펫을 ipython 노트북 콘솔에 복사하여 matplotlib 기능을 시험해 보았습니다. 코드 셀을 shift-enter 한 후에 슬라이더와 버튼이 나타나지만 기능은 전혀 없습니다.matplotlib.widget이 ipython 노트북에서 작동하지 않습니다.
ipython 노트북 - 필라 인라인을 실행하고 있습니다.
모든 의견을 보내 주시면 대단히 감사하겠습니다. 여기
는 가정 축을 변경됩니다 다음 및 이전 버튼 을 사인파을 나타내는 및 추가하는 예입니다,하지만 난 어떤 상호 작용을 얻을 :from matplotlib.widgets import Button
fig, ax = plt.subplots()
fig.subplots_adjust(bottom=0.2)
t = np.linspace(0, 10, 1000)
line, = plt.plot(t, np.sin(t), lw=2)
class Index:
dt = 0
def next(self, event):
self.dt -= 1
line.set_ydata(np.sin(t + self.dt))
fig.canvas.draw()
def prev(self, event):
self.dt += 1
line.set_ydata(np.sin(t + self.dt))
fig.canvas.draw()
callback = Index()
axprev = plt.axes([0.7, 0.05, 0.1, 0.075])
axnext = plt.axes([0.81, 0.05, 0.1, 0.075])
bnext = Button(axnext, '>')
bnext.on_clicked(callback.next)
bprev = Button(axprev, '<')
bprev.on_clicked(callback.prev)
혹시 이것을 알아 냈습니까? – lemiant