Valentyn
Valentyn

Reputation: 729

Matplotlib fails and hangs when plotting in interactive mode

I am getting a problem with my matplotlib library on MacOS High Sierra.

Here is my super simple code.

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

The python symbol appears on the dash board but the window cannot be found anywhere.

if I don't use ion() I can get one plot at a time.

enter image description here

Upvotes: 5

Views: 981

Answers (1)

JE_Muc
JE_Muc

Reputation: 5774

plt.ion() seems to be bugged. Try the following workaround:

plt.ion()
plt.plot(x,y)
plt.pause(0.0001)
plt.show()

If this still does not work, try replacing the last line with:

plt.show(block=True)

Upvotes: 3

Related Questions