1

I am trying to plot from a multiple column file where the first column is the x and the rest should be y columns like this:

plot for[col=2:36:1] 'datafile' using 1:col with lines lc rgb 'black' notitle

This works fine but what I want to do is to offset all the y columns by a constant value.

I tried something like this:

plot for[col=2:36:1] 'datafile' using 1:(col-const) with lines lc rgb 'black' notitle

but it doesn't work (it seems to plot the difference between the variable col and the constant value const).

Is there a way to do this? I have found here how to offset the y column for a 2 column file (or a specific column in a file)

plot 'otherdatafile' using 1:($2-const) with lines

but can this be expanded for my case?

Thanks in advance,

Lucian

1 Answer 1

2

Using 1:(column(col)-const) should work

Sign up to request clarification or add additional context in comments.

3 Comments

that did it! thank you very much! this should be marked as solved and make it easy for people to find because this feature is not obvious at all in gnuplot documentation!
It's quite prominently mentioned at the beginning of the using doc, gnuplotting.org/manpage-gnuplot-4-6/#Q1-1-324
thank you for pointing that out to me! I did read that bit but I couldn't understand the significance of it! Now it makes sense.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.