4

I have an application that produce log like that:

14:48:16, 41.0
14:50:01, 40.0
14:54:01, 41.0
14:54:04, 40.0
14:55:10, 41.0
14:55:22, 40.0
15:00:13, 41.0
...

It is current time and the measured temperature. The application writes a line to the log file when temperature changes.

I want plot a temperature graph via gnuplot and I tried that:

set xdata time
set timefmt "%H:%M:%S"
set yrange [30:50]
set xrange ["14:40":"16:50"]
plot 'temp.csv' using 1:2 with lines

It shows a graph like that:

graph

But I want the lines are horizontal and form a step at time when the temperature changes. The result should look like the blue line:

desired graph

How can I force gnuplot to do that? I can do that vi the log preprocessing but I want to do that only via gnuplot only if possible.

1 Answers1

3

Gnuplot has bunch of styles that can be used for displaying data. The with lines option connects each data point with lines. It is suitable to smoothly varying data.

Data containing the time and value that is valid since this time till next change is can be plot as a histogram. Gnuplot plots a histogram if the option with steps is specified. So the complete command is

plot 'temp.csv' using 1:2 with steps

Nice documentation and examples are at http://lowrank.net/gnuplot/intro/style-e.html.