user431336 user431336 - 1 year ago 91
Python Question

Can Gnuplot take different arguments at run time? maybe with Python?

I have 500 files to plot and I want to do this automatically. I have the gnuplot script
that does the plotting with the file name hard coded. I would like to have a loop that calls gnuplot every iteration with a different file name, but it does not seem that gnuplot support command line arguments.

Is there an easy way? I also installed the gnuplot-python package in case I can do it via a python script.However, I couldn't find the api so it's a bit difficult to figure out.

Thank you!

Answer Source

You can transform your gnuplot script to a shell script by prepending the lines

gnuplot << EOF

appending the line


and substituting every $ by \$. Then, you can substitute every occurence of the filename by $1 and call the shell script with the filename as parameter.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download