Reputation: 107
I want to name figures like this:
import matplotlib as plt
for i in range(0,3):
plt.figure('Method%s',%i)
But seems it is not possible this way.
another way I found is using super title but still it does not work:
from pylab import *
for i in range(0,3):
fig = gcf()
fig.suptitle('Method%s',%i)
do you know any solutions?
Upvotes: 1
Views: 3336
Reputation: 25023
If you need to use the figures you are going to create, it may be a good move to store them in some kind of data structure. In my example I will use a list and I will give also an example of using later one of the figures that have been instantiated.
Re naming your figures according to a sequence number, you are correct with the general idea but not with the details, as it happend that in plt.figure()
to have a user defined name you have to use a keyword argument that is not named name
as one could expect, but … num
…
figures = [plt.figure(num="Figure n.%d"%(i+1)) for i in range(3)]
# ^^^
...
figures[1].add_axes(...)
...
Upvotes: 1