jer...@um... wrote:
> I am writing a python script where I would like to send a number of graphs to
> different files. The number of graphs is undetermined beforehand. I was
> wondering if there was a way to use a variable in g('set output "filename"').
> So I could output to something like filename1, filename2, etc. where i would
> use a variable for the numbers.
Sure. For example, you can use Python's usual string interpolation:
g('set output "filename-%d.png"' % (file_number))
You might also want to check out the hardcopy() method, which
automatically does the "set term", "set output", etc.:
g.hardcopy(
filename=('filename-%d.png' % file_number),
terminal='png',
)
See the file "termdefs.py" to see what terminal types are already defined.
Michael
|