我正在尝试在ipython笔记本中创建一个交互式的情节。我试图从matplotlib的网站运行示例代码,如下所示。
t = arange(10)
plot(t, sin(t))
print("Please click")
x = ginput(3)
print("clicked",x)
show()我知道这个错误:
/Library/Python/2.7/site-packages/matplotlib/backend_bases.pyc in start_event_loop(self, timeout)
2370 This is implemented only for backends with GUIs.
2371 """
-> 2372 raise NotImplementedError
2373
2374 def stop_event_loop(self):
NotImplementedError: 我认为这与运行ipython、笔记本和HTML有关。这有可能解决吗?怎么做呢?
谢谢!
发布于 2013-09-17 00:12:21
如果您使用以下方法启动ipython笔记本:
ipython notebook --pylab=inline您不需要show()函数调用。情节将自动显示。show()函数仅在使用qt、wx、gtk之一时才需要.后端。
此外,ginput()函数在inline模式中不可用。如果你需要它,你应该启动笔记本使用一些其他后端,你已经安装。例如,qt或tk
ipython notebook --pylab=qt
ipython notebook --pylab=tkhttps://stackoverflow.com/questions/18839341
复制相似问题