I am trying to create an interactive plot in ipython notebook. I am attempting to run the sample code from matplotlib's website as below.
t = arange(10)
plot(t, sin(t))
print("Please click")
x = ginput(3)
print("clicked",x)
show()
I get this error:
/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:
I assume this has something to do with running ipython notebook and HTML. Is this possible to fix? and how?
thanks!!!
If you started the ipython notebook using:
You don't need the
show()
function call. Plots will be automatically shown. Theshow()
function is needed only when you use one of theqt
,wx
,gtk
... backends.Also, the
ginput()
function is not available in theinline
mode. If you need it, you should start the notebook using some other backend that you have installed. For exampleqt
ortk
: