Creative Commons License
This blog by Tommy Tang is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

My github papge

Tuesday, July 16, 2013

run ipython in emacs, matplotlib after ), the ipython buffer remains hanging

I was learning how to plot in python using the matplotlib library.
when I started in the terminal with

tommy@tommy-ThinkPad-T420:~$ ipython --pylab

In [1]: plot(range(4))
Out[1]: [<matplotlib.lines.Line2D at 0x37b4b50>]

the figure showed up automatically, and the prompt was active in the shell.

However, when I run it through emacs, the figure did not show up until I typed ),
and the ipython buffer is inactive unless you close the figure.  If you type ) again,
nothing will show up.

A quick google:

" Add pylab.ion() (interactive mode) before the call. That will make the UI run in a separate thread and the call to show will return immediately."

No comments:

Post a Comment