16

Suppose you need to store the figure and subplot in variables (to later modify attributes). How can you make the whole figure to stay and not quickly disappear after some millisecs?

import matplotlib.pyplot as plt

fig = plt.figure() 

ax = fig.add_subplot(2,2,1)
ax.plot(1)

fig.show()
Eric Leschinski
  • 146,994
  • 96
  • 417
  • 335
ritter
  • 7,447
  • 7
  • 51
  • 84

1 Answers1

30

Change fig to plt:

plt.show()
ritter
  • 7,447
  • 7
  • 51
  • 84
  • 2
    For me if you have `#plt.ion() # interactive mode, careful with uncommenting, things will dissapear` things disappear. Careful! – Charlie Parker Jul 10 '19 at 20:03