Get the list of figures in matplotlib

前端 未结 6 2053
南旧
南旧 2020-11-30 01:36

I would like to:

pylab.figure()
pylab.plot(x)
pylab.figure()
pylab.plot(y)
# ...
for i, figure in enumerate(pylab.MagicFunctionReturnsListOfAllFigures()):
           


        
6条回答
  •  有刺的猬
    2020-11-30 02:28

    This should help you (from the pylab.figure doc):

    call signature::

    figure(num=None, figsize=(8, 6), dpi=80, facecolor='w', edgecolor='k')

    Create a new figure and return a :class:matplotlib.figure.Figure instance. If num = None, the figure number will be incremented and a new figure will be created.** The returned figure objects have a number attribute holding this number.

    If you want to recall your figures in a loop then a good aproach would be to store your figure instances in a list and to call them in the loop.

    >> f = pylab.figure()
    >> mylist.append(f)
    etc...
    >> for fig in mylist:
    >>     fig.savefig()
    

提交回复
热议问题