Can not display plot with matplotlib under eclipse
Asked Answered
M

2

6

I have a strange problem with matplotlib under Eclipse I've tested this code and this works fine in the command line:

import matplotlib.pyplot as plt
import matplotlib.pylab as pylab
plt.plot([1,2,3,4])
plt.ylabel('some numbers')
plt.show()

But when I execute this code under Eclipse, there is nothing shown. I see that pydev understood all my imports and there is no error message.

Milt answered 20/11, 2012 at 11:10 Comment(3)
This anwsered my question #7534953Milt
If you found an answer, you should answer and accept your own answer. This makes it easier both for people looking to answer questions (as they can skip questions that are answered) and people looking for answers (as they might not click on questions (even if they seem relevant) that have no responses).Tufts
because it is a comment. Use the big text box at the bottom of the page. (there should be a button that says 'Post Your Answer' just below it)Tufts
A
0

using Ubuntu 12.04 and i have installed python3.3 This is what worked for me.

You need to have freetype. sudo apt-get install freetype*

You need to have freetype. sudo apt-get install python3.3-dev

You need to have g++. sudo apt-get install g++

You need to have libevent-dev sudo apt-get install libevent-dev

You need to have libpng-dev sudo apt-get install libpng-dev

You need to have libjpeg8-dev sudo apt-get install libjpeg8-dev

You need to have python3.3-tk sudo apt-get install python3.3-tk

You need to have tk-dev sudo apt-get install tk-dev

You need to have python-gtk2-dev sudo apt-get install python-gtk2-dev

Get the tar file from the website and untar it in the dist-packages /usr/local/lib/python3.3/dist-packages/matplotlib-1.3.1. sudo python3.3 setup.py clean (this might be optional) sudo python3.3 setup.py install

NOTE: I had to change the matplotlibrc file in the dist-packages in the mpl-data directory. The backend line was changed from agg to TkAgg and interactive was set to True.

Anabiosis answered 14/1, 2014 at 21:56 Comment(0)
A
0

In my case, the Python Interpreters doesn't recognize matplotlib installing. Try to apply Python Interpreters again.

Window -> Preferences -> PyDev -> Interpreters -> Python Interpreters -> Apply -> Select python interpreters -> OK -> Apply and Close.

Hope it works.

Airdrie answered 13/3, 2018 at 1:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.