0

When I run the following code on terminal:

import matplotlib.pyplot as plt
import numpy as np

x = np.arange(0, 5, 1)
y = np.arange(0, 5, 1)

plt.plot(x, y)
plt.show()

I get the following window:

enter image description here

But when I run the SAME code on Spyder, I get:

enter image description here

Why? And how I make the terminal generate the same interactive window?

Here they say it's because my matplotlib version is too old, but I already checked and it's the same (1.5.1) in both, Spyder and Terminal. Moreover, Qt and PyQt versions, 4.8.7 and 4.11.4 respectively, are the same in both, with both Spyder and terminal running Python 2.7.12.

I don't get why it is different. I wanna manipulate my graphs in a script, after generating them.

The matplotlib version is updated to 2.0.2

Thanks!

Jonas Kublitski
  • 119
  • 1
  • 11
  • The latest version of matplotlib is 2.0.2 – eyllanesc Aug 02 '17 at 17:16
  • Have you tried updating your version of matplotlib? – eyllanesc Aug 02 '17 at 17:17
  • I know, but I guess the difference is not int the `matplotlib` version, because get different results with the same version – Jonas Kublitski Aug 02 '17 at 17:18
  • I just ran it on spyder 3.1.4, python 2.7.13 and matplotlib 2.0.2 and I have no problems – eyllanesc Aug 02 '17 at 17:24
  • I just upgraded it to 2.0.2 and I still have the same problem. The layout of the buttons in the window even changed, but by running it on terminal I still get the adjust options in the left bottom corner, without the option to adjust the lines, curves, etc and by running it in Spyder I get them on the right top corner, with this option. – Jonas Kublitski Aug 02 '17 at 18:53
  • Have you tried running it without spyder? – eyllanesc Aug 02 '17 at 18:54
  • As I sad, if I run one script by opening it on spyder and run it there, I get the expected. If generate a plot in the console in spyder, I get it If I just run the same script by ./scripty.py in the terminal, I don't get it If I open python on terminal and generate a plot there, I also don't get it – Jonas Kublitski Aug 02 '17 at 19:02
  • I found what I want. Spyder plots interactive plots while running it on terminal you get normal plot. You have to specify `matplotlib.use('Qt4Agg')` just after calling matplotlib and before calling matplotlib.pyplot – Jonas Kublitski Aug 02 '17 at 20:27

0 Answers0