Reputation: 19
I'm trying to make a really simple animation of a voyage around the milky way.
for k in range(7):
Rs += k
Zs += 0.01*k
for i in range(len(B)):
print 'i=',i
for j in range(len(L)):
MAP[i,j] = DensiteCol(L[j], B[i], 20., 1000.)
plt.xlabel('l')
plt.ylabel('b')
plt.imshow(MAP)
plt.show()
#plt.savefig('Q8_'k'.jpg')
How can I save an image each time in the loop and save it as different names?
MAP[i,j] = DensiteCol(L[j], B[i], 20., 1000.)
In this case, is L the axe horizontal or B is?
Upvotes: 0
Views: 97
Reputation: 2233
Sometimes it's useful to get the files in the right order so:
plt.savefig("Q8_{:04d}.jpg".format(k))
Upvotes: 3
Reputation: 32189
You can do it as follows:
plt.savefig('Q8_' + str(k) + '.jpg')
Upvotes: 1