Reputation: 151
(gnuplot 5.2.5, Centos 7) I've tried about 8 google examples and my result is still not even close.
Here is my data:
Timestamp,1016.qmgr,1893.sshd,1.systemd,2017.sshd
2018-11-21.04:23:03,0.1,1.0,4.0,2.0
2018-11-21.04:23:04,0.2,2.0,5.0,4.0
2018-11-21.04:23:05,0.3,3.0,6.0,8.0
Here are my plot settings:
set datafile separator ","
set title "CPU % Usage per task over time"
set ylabel '% CPU'
set xlabel 'Time'
set grid
set term png
set output '10.png'
set key autotitle columnheader
plot for [i=2:5] 'Results.10/CPU.csv' using 1:i'
Basically, I was expecting something like this:
But I got something like this:
Any ideas what to set in the plot parameters file?
Upvotes: 0
Views: 49
Reputation: 15143
You need to tell gnuplot that the first column contains time data, and also what the format is:
set xdata time
set timefmt "%Y-%m-%d.%H:%M:%S"
There are other ways to do it, but that is the simplest way to deal with time specified as a string.
[amended answer] If you just want the content of the first column printed along x as an opaque text string, the command is:
plot for [i=2:5] 'Results.10/CPU.csv' using 0:i:xticlabels(1)
Because these strings are very long, you probably will need to rotate the labels so they do not overlap:
set xtics rotate by -45
Upvotes: 1