I want to plot large data file sequences from computer-generated Gnuplot
scripts. Such a script consists of dozens (or even hundreds) of plot
commands, and the computer-generated script is being loaded from a
driver script via the load command. The data are divided in columns as
usual. I now want to select the columns to be used for plotting by
setting a switch in the driver file.
Normally, data file columns are specified with e.g.
plot 'file' using 1:2
or
plot 'file' using (f($1)):(f($2))
I found that in the former case one could replace the column numbers by
integer variables, e.g.
c1=1;c2=2
plot 'file' using c1:c2
But is it also possible to use variables for column numbers as a
function argument? "$c1" or similar don't work. For now, I can only do
this by replacing the column specifier in all the lines by
search&replace, but a global switch would be much more convenient.
Does anyone have any hints if this can be done?
Ingo
This could be done using macros "help macro", but the clean way is
via the column() function (help column) [untested]:
c1=1;c2=2
plot 'file' using (column(c1)):(column(c2))
Juergen
> This could be done using macros "help macro", but the clean way is
> via the column() function (help column) [untested]:
>
> c1=1;c2=2
> plot 'file' using (column(c1)):(column(c2))
Ah, this works fine, thanks!
Ingo