-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Description
I'm running matplotlib 2.0.0, installed with pip, with the TkAgg backend and Python 3.5.2 on Lubuntu 16.10. If I open the Python REPL and type
>>> import matplotlib.pyplot as plt
>>> plt.ion()
>>> plt.plot([1, 2, 3])
then, as I expect, a Tk window with the figure appears after the final command.
However, if I instead do:
>>> import matplotlib.pyplot as plt
>>> plt.plot([1, 2, 3])
>>> plt.ion()
>>> plt.plot([4, 5, 6])
no figure window appears, even after the last command. It seems that running any plotting command before plt.ion prevents it from having its usual effect.
You might ask why I don't just make sure to type plt.ion() first. The answer is I have a function named matplotlib_prelude containing some startup commands that's run automatically when I start the Python REPL, and if I call plot.ion before this, a figure window will open even though I haven't plotted anything yet (and indeed I may not use matplotlib at all this session). Here's what I have in matplotlib_prelude at the moment:
import matplotlib.pyplot as plt
plt.tick_params(right = False, top = False)
plt.gca().spines["top"].set_visible(False)
plt.gca().spines["right"].set_visible(False)
This used to work before matplotlib 2: I called plt.ion first, and these startup lines didn't cause a figure window to open.