Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
304 views
in Technique[技术] by (71.8m points)

python - How to save multiple plots in a folder

Here is my program in python and I am trying to save multiple plots in a single folder but it doesn't seem to work. How could I do this please?

for i in range(0:244):
plt.figure()
y = numpy.array(Data_EMG[i,:])
x = pylab.linspace(EMG_start, EMG_stop, Amount_samples)
plt.xlabel('Time(ms)')
plt.ylabel('EMG voltage(microV)')
pylab.plot(x, y)
pylab.show(block=True)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can use the savefig function.

for i in range(0:244):
    plt.figure()
    y = numpy.array(Data_EMG[i,:])
    x = pylab.linspace(EMG_start, EMG_stop, Amount_samples)
    plt.xlabel('Time(ms)')
    plt.ylabel('EMG voltage(microV)')
    plt.savefig('EMG {0}.jpg'.format(i))
    plt.close()

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...