Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #2593 > unrolled thread

Plot room temperature

Started byAndreas Weller <weller@andreas-weller.de>
First post2014-09-24 14:19 +0200
Last post2014-09-24 07:50 -0700
Articles 2 — 2 participants

Back to article view | Back to comp.graphics.apps.gnuplot


Contents

  Plot room temperature Andreas Weller <weller@andreas-weller.de> - 2014-09-24 14:19 +0200
    Re: Plot room temperature Kalin Kozhuharov <me.kalin@gmail.com> - 2014-09-24 07:50 -0700

#2593 — Plot room temperature

FromAndreas Weller <weller@andreas-weller.de>
Date2014-09-24 14:19 +0200
SubjectPlot room temperature
Message-ID<lvucse$4uv$1@speranza.aioe.org>
Hello.

I'm currently logging my room temperature to a txt file. It is composed
this way:
date in rfc-2822 format + Semicolon separator + Temp.
example lines here:
Wed, 24 Sep 2014 14:08:08 +0200;Temp.: 20.9°C
Wed, 24 Sep 2014 14:10:08 +0200;Temp.: 20.6°C

Now I would like to plot the graph using gnuplot. Please provide me some
help with this - especially the timefmt for rfc-2822...

Thank you!


Regards,
  Andreas Weller

[toc] | [next] | [standalone]


#2595

FromKalin Kozhuharov <me.kalin@gmail.com>
Date2014-09-24 07:50 -0700
Message-ID<a51b64a2-67b1-4933-a682-19612fb519a6@googlegroups.com>
In reply to#2593
Hello Andreas,

On Wednesday, September 24, 2014 9:19:29 PM UTC+9, Andreas Weller wrote:
> I'm currently logging my room temperature to a txt file. It is composed
> this way:
> date in rfc-2822 format + Semicolon separator + Temp.
> example lines here:
> 
> Wed, 24 Sep 2014 14:08:08 +0200;Temp.: 20.9°C
> Wed, 24 Sep 2014 14:10:08 +0200;Temp.: 20.6°C
>
Congratulations on one of the "worst" formats to plot ;-)
Is there any reason why the format is so?
* RFC-2822 is as bad as it can get (search why), use ISO-8601 always
* having a mix of unnamed field (timestamp) and key-value pair (Temp.:20) is a recipe for disaster
* The "°C" might look nice, but it still wreaks havoc in many processing systems (Net used to be ASCII, UTF-8 is far from working everywhere)

> Now I would like to plot the graph using gnuplot. Please provide me some
> help with this - especially the timefmt for rfc-2822...
> 
My approach, if I really had to deal with that, will be to convert it like this:
timestamp,T_C
2014-09-24T14:08:08+0200,20.9
2014-09-24T14:10:08+0200,20.6

then plot it the usual way:
reset;
set datafile separator ",";
set xdata time;
set timefmt x "%Y-%m-%dT%H:%M:%S+0200";
set format x "%Y-%m-%d\n%H:%M:%S";
plot "/tmp/b" u 1:2 w lp

NB: gnuplot doesn't seem to have the notion of timezones... (tried %z before).

Going backwards, you can sidestep some of the timestamp and to plot your original data:
reset;
set datafile separator " ";
set xdata time;
set timefmt x "%d %b %Y %H:%M:%S";
set format x "%Y-%m-%d\n%H:%M:%S";
plot "/tmp/a" u 2:7 w lp

See the weired "u 2:7" ? It is just a hack...

Please consider designing reliable systems; it helps save trees down the road.

Cheers,
Kalin.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web