Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Data manipulation (gnuplot)

354 views
Skip to first unread message

Dan Merschi

unread,
Sep 7, 2013, 12:00:10 PM9/7/13
to
Hi

I have a temperature log file like this:

tail -12 /logs/temp_20130906.log
28D942A603000062 1378503243 21.94
28F357A6030000B5 1378503245 46.06
284743A60300000D 1378503248 18.75
28D942A603000062 1378503364 21.88
28F357A6030000B5 1378503366 45.94
284743A60300000D 1378503368 18.75
28D942A603000062 1378503484 21.88
28F357A6030000B5 1378503486 45.62
284743A60300000D 1378503488 18.75
28D942A603000062 1378503604 21.88
28F357A6030000B5 1378503606 45.25
284743A60300000D 1378503608 18.75

As you can see the master pull the devices every 2 minutes at 2 seconds interval.
Right now I use awk collect only the records for the last 24 hours , split the log file into sensor file and plot the graph for each sensor as:

plot "284743A60300000D.log" using 2:3 title "Out" with lines lt 1 lw 1 lc rgb 'black'\
,"28D942A603000062.log" using 2:3 title "In" with lines lt 1 lw 1 lc rgb 'blue'\
,"28F357A6030000B5.log" using 2:3 title "Tank" with lines lt 1 lw 1 lc rgb 'red'


The question is can I plot directly from gnuplot without using external applications.

Right now I have only 3 sensors but as soon I will add more sensors and that will increase the processing time.

Regards,
Daniel

Hans-Bernhard Bröker

unread,
Sep 7, 2013, 2:13:37 PM9/7/13
to
On 07.09.2013 18:00, Dan Merschi wrote:

> As you can see the master pull the devices every 2 minutes at 2 seconds interval.
> Right now I use awk collect only the records for the last 24 hours , split the log file into sensor file and plot the graph for each sensor as:
>
> plot "284743A60300000D.log" using 2:3 title "Out" with lines lt 1 lw 1 lc rgb 'black'\
> ,"28D942A603000062.log" using 2:3 title "In" with lines lt 1 lw 1 lc rgb 'blue'\
> ,"28F357A6030000B5.log" using 2:3 title "Tank" with lines lt 1 lw 1 lc rgb 'red'
>
>
> The question is can I plot directly from gnuplot wit%Shout using external applications.

That's going to prove trick, particularly the "reducse to the last 24
hours worth of data" job. Once you've solved that, you can probably do
something like

set ydata time
set timefmt y "%s"

splot "temp_last_24h.log" u 1:2:3:xticlabels(1) with lines

for a quick overview. Individual sensors' data should be available via

plot "temp_last_24h.log" u (stringcolumn(1) eq '28D942A603000062' ?
$2 : NaN):3 w l

Dan Merschi

unread,
Sep 7, 2013, 8:17:14 PM9/7/13
to
On Saturday, September 7, 2013 2:13:37 PM UTC-4, Hans-Bernhard Bröker wrote:

>
> That's going to prove trick, particularly the "reducse to the last 24
>
> hours worth of data" job. Once you've solved that, you can probably do

I set the following variable for 24 hours ago timestamps.
YesterdayS=$(/bin/date "+%s" --date="1 days ago")

Now I just need a gnuplot like query to compare the $YesterdayS value to second column. Something like that.


> splot "temp_last_24h.log" u 1:2:3:xticlabels(1) with lines

This is the error I got for the previous command

line 0: warning: Too many axis ticks requested (>7e+04)

>
> for a quick overview. Individual sensors' data should be available via
>
>
>
> plot "temp_last_24h.log" u (stringcolumn(1) eq '28D942A603000062' ?
>
> $2 : NaN):3 w l

I try your command but that take forever, no output.


Thanks Hans for your help.
0 new messages