Gnuplot misreads time data

后端 未结 1 603
借酒劲吻你
借酒劲吻你 2021-01-19 15:39

I can\'t seem to get gnuplot to properly plot my time data. (I\'m using version 4.6, patchlevel 3.)

For an MWE (well, non-working...), the input file



        
1条回答
  •  醉话见心
    2021-01-19 16:29

    With $1 you explicitely select the numerical value of the first column, which bypasses any gnuplot automatism to interpret the column values as appropriate (as time value in your case). Simply use using 1:2:

    reset
    set xdata time
    set timefmt "%H:%M:%S"
    set format x "%H:%M:%S"
    
    plot '-' using 1:2 with lines lw 3
    15:36:12  1.0
    15:43:17  3.0
    16:12:02  2.0
    e
    

    Use the syntax $1 only when doing calculations with the actual numerical value in the respective column. $1 is a shortcut for column(1), gnuplot also knows stringcolumn(1) and timecolumn(1) for other purposes.

    0 讨论(0)
提交回复
热议问题