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


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

Newbie Help - Can gnuplot do what I need without modifying the input file?

Started byeamonn.carlin@gmail.com
First post2017-11-16 13:05 -0800
Last post2017-11-20 14:46 -0800
Articles 3 — 2 participants

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


Contents

  Newbie Help - Can gnuplot do what I need without modifying the input file? eamonn.carlin@gmail.com - 2017-11-16 13:05 -0800
    Re: Newbie Help - Can gnuplot do what I need without modifying the input file? Karl Ratzsch <mail.kfr@gmx.net> - 2017-11-17 10:10 +0100
      Re: Newbie Help - Can gnuplot do what I need without modifying the input file? eamonn.carlin@gmail.com - 2017-11-20 14:46 -0800

#3820 — Newbie Help - Can gnuplot do what I need without modifying the input file?

Fromeamonn.carlin@gmail.com
Date2017-11-16 13:05 -0800
SubjectNewbie Help - Can gnuplot do what I need without modifying the input file?
Message-ID<b0451901-7c2a-4dce-be1c-0858c35937c3@googlegroups.com>
I'm using python on a Pi to log movement detected by a Infrared sensor. I'd like to represent the data on a line/bar graph with time on the x axis and the y axis being binary to represent movemnet (1) or no movement (0).

Each movement will be recorded as a new row on the log (csv) file.

Here is an example of the data:

Start Date,Start Time, End Date, End Time, Duration
2017-11-02,19:45:20,2017-11-02,19:45:59,0:00:38
2017-11-02,22:26:53,2017-11-02,22:27:50,0:00:56
2017-11-03,01:09:49,2017-11-03,01:10:31,0:00:42
2017-11-03,01:23:23,2017-11-03,01:23:43,0:00:20
2017-11-03,04:24:10,2017-11-03,04:33:03,0:08:52

The monitoring is daily within a defined window (7pm to 7am) and a separate log file is created for each logging window.

I would like my graph to represent the entire period of 7pm to 7am.

Is it possible for gnuplot to represent a graph to my requirements without the need to modify the existing input file? My fear is that I may need to create a new input file specifically for gnuplot where each minute is recorded as a new row in the file with either 1 or 0 to show movement during that minute.

I'm new to gnuplot so any advice would be appreciated.

[toc] | [next] | [standalone]


#3822

FromKarl Ratzsch <mail.kfr@gmx.net>
Date2017-11-17 10:10 +0100
Message-ID<oum92g$8ao$1@solani.org>
In reply to#3820
Am 16.11.2017 um 22:05 schrieb eamonn.carlin@gmail.com:
> I'm using python on a Pi to log movement detected by a Infrared sensor. I'd like to represent the data on a line/bar graph with time on the x axis and the y axis being binary to represent movemnet (1) or no movement (0).

> Start Date,Start Time, End Date, End Time, Duration
> 2017-11-02,19:45:20,2017-11-02,19:45:59,0:00:38
> 2017-11-02,22:26:53,2017-11-02,22:27:50,0:00:56
> 2017-11-03,01:09:49,2017-11-03,01:10:31,0:00:42

You can make a vector plot,

  plot dataf us 2:(1):5:(0) with vectors

, however that only gives you lines over "duration" (at y=1), not in
the standstill time inbetween (0).

Easiest would be if you recorded the standstill times also, e.g.

1am 30min 1
1:30am 1h 0
2:30am 40min 1
3:10am 10 min 0
etc.

but I think we can do without:

  replot l=("7am"), dataf us (ll=l,l=$4,ll):(0):($2-ll):(0) with vectors

(replace "7am" with 7*3600, that's not plotted, it only initialises
l before plotting to the given value)

This stores the value of column 4 in "l" after shifting the last
value of "l" into "ll", and then plots a vertical line from "ll"
with lenght of the time between the last datapoint and the present.

Check "help ternary operator" about the first part of the "using"
specifier. It could be a bit tricky if the first movement starts at
exactly 7am

[toc] | [prev] | [next] | [standalone]


#3824

Fromeamonn.carlin@gmail.com
Date2017-11-20 14:46 -0800
Message-ID<87ff56be-33b0-42ae-8b6e-9e47aefd252f@googlegroups.com>
In reply to#3822
Awesome Karl! I can’t say I understand how all of those command work but  ow that I know it’s pissible I’ll do my research to understand them.

[toc] | [prev] | [standalone]


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


csiph-web