You can simply set figure f1
as the new current figure with:
pl.figure(f1.number)
Another option is to give names (or numbers) to figures, which might help make the code easier to read:
pl.figure("Share values")
# ... some plots ...
pl.figure("Profits")
# ... some plots ...
pl.figure("Share values") # Selects the first figure again
In fact, figure “numbers” can be strings, which are arguably more explicit that simple numbers.
PS: The pyplot equivalent of pylab.figure()
is matplotlib.pyplot.figure()
.
PPS: figure()
now accepts a Figure
object, so you should be able to activate figure f1
with figure(f1)
.