3

I'm plotting a column of data which represents a time series in gnuplot. Every value represents a time value after 500 iterations / time units. Can I tell gnuplot to multiply the x-values it displays by 500?

I thought this would be a standard problem since every time one has to plot a time series one needs to tell the plotting program what time unit each iteration has.

I don't want to create an extra column with x-values manually, since I have a lot of different data of different length. I don't want to create a x column for everyone of them.

1 Answer 1

6

If you have only a single column, gnuplot uses the row number as x value. This can be accessed by the pseudo column 0 and scaled like

plot 'datafile' using ($0*500):1

or equivalently, if you're calling this from a shell script

plot 'datafile' using (column(0)*500):1
Sign up to request clarification or add additional context in comments.

6 Comments

As I said, I unfortunately don't have a x column. I have only a y-column representing the y-values in a time series. The temporal spacing between every y-value is the same.
Still no luck. I'm using a plotting script (bash-script) which is why $0 is interpreted as the first command line argument.
How should I know? You haven't mentioned this with a single word... Then use column(0)*500.
Sorry for that. I didn't think of that in the beginning. It works now. Thanks a lot
Or \$0 instead of column(0)
|

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.