Search code examples
gnuplotinteger-overflow

How to draw a horizontal line at the large y-axis integer?


For the following data.dat file:

08:01:59 451206975237005878
08:04:07 451207335040839108
08:05:56 451207643872368805
08:07:49 451207961547842270
08:09:56 451208317883903787
08:10:12 451208364811411904
08:14:09 451209030026853864
08:16:19 451209395116787156
08:17:14 451209552481002386
08:20:22 451210080432357203
08:25:36 451210963309583903
08:30:23 451211772783766177
08:34:04 451212394854723707
08:35:53 451212702239472024
08:48:46 451214876715294857
08:49:56 451215072475511660
08:51:24 451215321890488523
08:52:39 451215533925588479
08:52:42 451215542324801784
08:54:30 451215845971562410
08:55:08 451215951262906948
08:58:30 451216519498960432

I'd like to draw a horizontal line at the specific level (e.g. 451211772783766177). However, the number is too large to process.

Here is my attempt (based on this post):

$ gnuplot -p -e 'set arrow from 451211772783766177 to 451211772783766177; plot "data.dat" using 2 with lines'

which gives the following error:

line 0: warning: integer overflow; changing to floating point

How I should proceed?


Solution

  • I would treat your large number as a constant function, and plot it right after your data. Also, writing it on a exponential notation X.XE+YY = X.X times 10 to the +YY power (more info on format specifiers here) also takes care of the error:

    plot "data.dat" using 2 with lines, 4.51211772783766177E17 with lines
    

    Let me know if this works!