I'm just playing with matplotlib inside IPython for my
> first time and want to do the equivalent of:
> In : subplot(211) In : plot([1,2,3]) In : show()
-> displays as expected, in the upper half
Use ipython in the pylab mode -- it will detect your backend and do
the right thing if threading is required, and will set the matplotlib
interactive state to be True.
> ipython --pylab
> Now I want to interactively display a 2nd plot in the
> bottom, but when I do: In : subplot(212)
> I get a new, single empty plot displayed in the lower half.
> Is there some 'hold' cmd I'm missing to do this?
In matplotlibrc -- http://matplotlib.sf.net/.matplotlibrc -- there is
an axes.hold parameter. matplotlib ships with axes.hold : True by
default, so this should be your setting unless you changed it in a
past life. It may be that the strangeness you are seeing vis-a-vis
subplot(212) stems from not using interactive mode properly in
conjunction with unsupported use of show, which should not be used in
interactive mode as explained in the FAQ.
You can query the current hold state with "ishold" and set it with "hold".
Notice in the following pylab interactive session I don't need to
import pylab as ipython does it for me; just make sure you're using a
recent version of ipython and matplotlib.
John-Hunters-Computer:~> ipython --pylab
Python 2.3 (#1, Sep 13 2003, 00:49:11)
Type "copyright", "credits" or "license" for more information.
IPython 0.6.6 -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
%magic -> Information about IPython's 'magic' % functions.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
Welcome to pylab, a matplotlib-based Python environment
help(matplotlib) -> generic matplotlib information
help(pylab) -> matlab-compatible commands from matplotlib
help(plotting) -> plotting commands
In : ishold()
In : hold(False)
In : ishold()