Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

matplotlib does not work in Eclipse

I seem to have a problem that is in parts very similar to the one mentioned here:
Python with eclipse import problem

But unfortunatly just in parts otherwise that would have solved mine as well.

I use Eclipse SDK, Version: 3.7.0 with PyDev 101. Furthermore I have installed numpy-1.6.1rc1-win32-superpack-python2.6.exe and matplotlib-1.0.1.win32-py2.6.exe as noted here: http://matplotlib.sourceforge.net/users/installing.html

I have rebuild all the packages and looks the site-packages are listed.

(by the way as you see it is an Python version installed with ArcGIS )

If I test a script for instance a very simple one like:

import numpy 
import matplotlib
import pylab as pl

I get the following error in Eclipse: import matplotlib import pylab as pl from matplotlib.pylab import * ImportError: No module named pylab

Even though the interpreter for Pydev is pointing to the appropriate version of python and matplotlib is installed properly in there (site-packages) it does not work in Eclipse. In iPython it works perfect.

What still needs to be done to get matplotlib work in Eclipse?

Thanks a lot!

Werner

like image 514
Werner Avatar asked Oct 11 '22 15:10

Werner


2 Answers

pylab is in matplotlibs namespace, so this should work:

import matplotlib.pylab as pylab
like image 63
tillsten Avatar answered Oct 14 '22 02:10

tillsten


I found that turning off interactive move and then calling show worked.

import matplotlib.pyplot as plt

#...your code...

plt.ioff()
plt.show()
like image 31
Walt Avatar answered Oct 14 '22 03:10

Walt