Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gnuplot statistics with time data (converted from string as float) fails as single argument

I have a data file with time data as one column. Since the stats command is not compatible with time data(Stats command not available in timedata mode), we have to do some conversion first:

set xdata
stats 'data' u (strptime(fmt,strcol(1)))

this does not work however. gnuplot prints the following error: All points out of range

I don't know why, but I had the idea to use a second artificial column:

stats 'data' u (strptime(fmt,strcol(1))):(1.0)

This works as intended (why?), but with an unnecessary second column. For me, this "workaround" is ok, because I don't have big data files to plot, but if people had... This could be quite annoying.

Did I miss something?
Why does gnuplot stats behaves this way?
Is this a bug, worth reporting?

like image 686
nox Avatar asked Jun 07 '26 18:06

nox


1 Answers

Probably you have set an yrange before calling the stats command. If you call stats with a single column, the data is treated as y-column. In your second call you give an explicit second column, and the time data is treated as x-column.

Calling

reset
fmt = "%Y..."
stats 'data' u (strptime(fmt,strcol(1)))

should work fine.

like image 142
Christoph Avatar answered Jun 10 '26 09:06

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!