Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change x-values in gnuplot

Tags:

gnuplot

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.

like image 883
mcExchange Avatar asked Sep 11 '26 11:09

mcExchange


1 Answers

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
like image 159
Christoph Avatar answered Sep 13 '26 07:09

Christoph



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!