0
votes

I have a program which generates several plots.. Now I need to save each plot in a different file like say: file1, file2, file2,...

P.S: I am using Gnuplot to save and generate the plots:

g('set output \"test.ps\"')

How do I generate these names?

1
Generating the strings should be easy if you're familiar with Python, what part are you having issues with? - dfb
in the code: g('set output \"test.ps\", I need to keep saving files as test1, test2, test2.. This just generates all graphs with the name test.ps - amitash
use g('set output \"test%d.ps\"' % n), and make n increase. - Thomas K
@Thomas, post your answer as an answer please. - BrainStorm

1 Answers

1
votes

You need to use string formatting. The simplest option is to use

g('set output \"test%d.ps\"' % n)`

and make n increase.