I don't know if this is possible and I hope to acurally portray what I wish to accomplish.
Say we have:
from pylab import *
import matplotlib.pyplot as plt
%matplotlib inline
fig = plt.figure(figsize=(10,10))
y = 2
for x in xrange(0,5):
value = [1,int(y)]
plt.plot(value)
plt.savefig("value" + y + ".png")
y+=1
So my goal here is to get 5 plots (or I think this would give me 6 plots), but I want them to each save with different names so they don't overwrite each time it goes through the loop. Is this possible?
Note: The numbers and values in this example are arbitrary. My hope is just to plot in a loop like this and have a dynamic method to save the name of the figure.
You don't need y, just use the x in your loop.
for x in xrange(1,6): # starts at 1 and goes to 5
print ("value" + str(x) + ".png")
value1.png
value2.png
value3.png
value4.png
value5.png
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With