Reputation: 20663
I have the following data file:
Time;Server;Hits
2011.05.05 12:00:01;Server1;12
2011.05.05 12:00:01;Server2;10
2011.05.05 12:00:02;Server1;2
2011.05.05 12:00:02;Server2;4
So, far I have come up with the following gnuplot script:
set datafile separator ";"
set autoscale
set xdata time
set timefmt "%Y.%m.%d %H:%M:%S"
set xtics rotate
set term png
set output "hits.png"
set style fill solid 0.5
plot "hits.log" using 1:3 title 'Hits'
But that one plots data from both servers on the same graph as one data series. How do I make gnuplot to display 2 data series: one for each server?
Upvotes: 3
Views: 1751
Reputation: 20663
I found a soluton myself:
plot "hits.log" using 1:(stringcolumn(2) eq "Server1" ? $3 : 1/0) title 'Server1' with lines,\
"hits.log" using 1:(stringcolumn(2) eq "Server2" ? $3 : 1/0) title 'Server2' with lines
Upvotes: 5