I have the following snippet to have a graph output via gnuplot.

set datafile separator "," set title "Memory" set xlabel "Values" set ylabel "Date" set ydata time set timefmt "%H" set format y "%d/%m/%Y" set key left top set grid plot 'memory-memory-buffered_combined' using 0:2 titl "1" with lines,\ 'memory-memory-cached_combined' using 0:2 title "2" with lines cat pause -1 

However, when I have the result it starts from 1970.

The first 5 lines of the csv I am reading;

epoch,value 1478193413.596,72910 1478193473.412,134432 1478193413.158,65449 1478193411.929,60157 

So, it is actually November 2016.

Which part of my script should be different?

1 Answer

Your main issue is that your time data is in the first column of the file, however you want to use that as y-data rather than x-data. So you need to plot using 2:1

The second issue is that your timefmt specifier needs to be %s (epoch time: this is the format of your input data) rather than %H.

So

set datafile separator "," set title "Memory" set xlabel "Values" set ylabel "Date" set ydata time set timefmt "%s" set format y "%d/%m/%Y" set key left top set grid plot 'data.csv' using 2:1 title "1" with lines 

resulting in GNUPLOT chart of user's data