I have a dataset with multiple columns of data, which I plot using a loop
plot for [i=2:19] 'myfile.txt' using 1:i
I would like to scale my data by dividing by 1024. Outside of a loop I can do this with:
plot 'myfile.txt' using 1:($2/1024)
I would like to combine these two, but the following does not work:
plot for [i=2:19] 'myfile.txt' using 1:($i/1024)
I imagine it is to do with the order that the substitutions are happening in.
Can any one show me an elegant solution here?
Many thanks
You can use column(i)
instead of $i
:
plot for [i=2:19] 'myfile.txt' using 1:(column(i)/1024.)
should work.