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 plot.show( ), 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 plot.show( ),
and the ipython buffer is inactive unless you close the figure.  If you type plot.show( ) again,
nothing will show up.

A quick google:

http://stackoverflow.com/questions/9753885/pylab-matplotlib-show-waits-until-window-closes

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








4 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. I recently started reading blogs and now I am interested in reading yours and following all your blogs on the whole.
    really nice to red this blog
    Ai & Artificial Intelligence Course in Chennai
    PHP Training in Chennai
    Ethical Hacking Course in Chennai Blue Prism Training in Chennai
    UiPath Training in Chennai

    ReplyDelete
  3. Thanks for sharing this—learned a lot
    Explore KUDA approval plots in Kurnool offering clear titles, planned layouts, wide roads, and secure investment potential. Ideal for building your dream home in fast-growing residential zones with trusted approvals and long-term value.
    KUDA approval plots in kurnool

    ReplyDelete