Running Matplotlib or enthought.mayavi.mlab from a py-shell inside Emacs on Windows
Asked Answered
F

2

2

I can run the following code fine from a regular cmd shell:

import matplotlib.pyplot as plt
fig = plt.figure()
plt.show()

It launches a Matplotlib window. However, running inside Emacs using shell or py-shell: the buffer just hangs and no window is launched. What's going on here and how can I fix it?

Flower answered 15/1, 2011 at 19:16 Comment(1)
Works for me (Debian Linux, Emacs 23.2.1, Python 2.6.6, matplotlib 0.99.3). What platform and software versions are you using?Mail
F
0

I got it working with ipython.el.

I had to add modify python26\scripts\ipython.bat:

@"c:\Python26\python.exe" "-i" "c:\Python26\scripts\ipython.py" "-wthread" %*

Then in Emacs:

(setq ipython-command "c:/python26/scripts/ipython.bat")
(require 'ipython)
(py-shell)
Flower answered 15/1, 2011 at 20:27 Comment(0)
A
0

After a tremendous amount of time and posting the bug on the matplotlib project page and the python-mode page I found out that supplying the arguments console --matplotlib in ipython.bat will do the trick with Matplotlib 1.3.1 and IPython 1.2.0.

This is what I have in my iphython.bat file:

@python.exe -i D:\devel\Python27\Scripts\ipython-script.py console --matplotlib %*
Aurita answered 21/2, 2014 at 15:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.