|
From: Benjamin R. <ben...@ou...> - 2012-08-05 15:58:45
|
On Sunday, August 5, 2012, Nikolaus Rath wrote: > Hello, > > The following code shows the plot right away as expected: > > # python > Python 2.7.3rc2 (default, Apr 22 2012, 22:30:17) > [GCC 4.6.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import matplotlib > >>> matplotlib.__version__ > '1.1.1rc2' > >>> import matplotlib.pyplot as plt > >>> plt.interactive(True) > >>> plt.plot(range(10)) > [<matplotlib.lines.Line2D object at 0x2ce7790>] > > > This, however, opens a window but the graph never shows up: > > # python > Python 2.7.3rc2 (default, Apr 22 2012, 22:30:17) > [GCC 4.6.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import matplotlib.pyplot as plt > >>> plt.interactive(True) > >>> fig = plt.figure() > >>> ax = fig.add_subplot(1,1,1) > >>> ax.plot(range(10)) > [<matplotlib.lines.Line2D object at 0x3055d90>] > >>> > > Does interactive mode only apply to the plot commands in pyplot? > > Is there a method I can call in this case to "refresh" the window and > show the plot? > > For seem reason, calling plt.axes() has the desired effect, but this is > probably a side effect that I really should not rely on, right? > > > Thanks! > > -Nikolaus Correct, I think you want plt.draw(). Cheers! Ben Root |