Search code examples
plotgnuplotscaleaxis

Gnuplot: x axis scale for 1-column data spaced every two seconds


I have 1 column of data:

plot "memory.log" w lp notitle pt -1 lw 1

Time spacing between records is 2 seconds. How can I plot it in [hours] scale insteadt of [2 seconds] scale on x axis?


Solution

  • plot "memory.log" using (column(0)*2/60):1 w lp notitle pt -1 lw 1
    

    should work. See "pseudocolumns". The parenthesis around the first using parameter are required when doing math.

    Gnuplot "pseudocolumns". expressions in the using clause of a plot statement can refer to additional bookkeeping values in addition to the actual data values contained in the input file. These are contained in "pseudocolumns".

    column(0)   The sequential order of each point within a data set.
                  The counter starts at 0 and is reset by two sequential blank
                  records.  The shorthand form $0 is available.
    
    column(-1)  This counter starts at 0 and is reset by a single blank line.
                  This corresponds to the data line in array or grid data.
    
    column(-2)  The index number of the current data set within a file that
                  contains multiple data sets.  See `index`.