0

I am working in Spyder (Python) to analyze some information. I am plotting the data, but something odd is happening. When I run the code all together, the final plot is ok. Doing the same in the Spyder Console I get several figures, one by one.

Is it possible to run command by command in the console and to obtain a proper graph?

I include the code I am working with, but it is not the important part. As said above, running it all together, runs properly.

Thanks,

import numpy as np

x = np.arange(start=0,
              stop=np.pi*2,
              step=np.pi*2/12)
y1 = np.sin(x)
y2 = np.cos(x)

plt.plot(x, y1, "bo", label='First Line')
plt.plot(x, y2, label='Second Line')

plt.xlabel('Angle, rads')
plt.ylabel('Value')
plt.title('This is an Example')
plt.legend()
plt.show()

Image running all the code:

Running all

Image running a single command:

Runnung a command

Image running another command:

El-VeRdUgO
  • 21
  • 5

0 Answers0