Data Visualisation

A forum to organise work carried out by Canford School students
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Data Visualisation

Post by TerryJC »

Thank you Philipp. This is exactly the kind of thing we need.
Terry
Philipp
Posts: 8
Joined: 14/01/2019, 15:13

Re: Data Visualisation

Post by Philipp »

one_day_histep.png
one_day_histep.png (47.18 KiB) Viewed 1361 times
Same graph, just with the "histep" mode. More accurately represents the data, but not the actual water levels changing. Decided to use the smooth variant shown before.
Penri
Posts: 1284
Joined: 18/05/2017, 21:28

Re: Data Visualisation

Post by Penri »

Philipp, this is good work, I like the way it's developing.
Philipp
Posts: 8
Joined: 14/01/2019, 15:13

Re: Data Visualisation

Post by Philipp »

ok, finally been able to plot multiple water levels on the same graph. I had to rename the files to suit the command I ran to make this possible. The command also requires all files to be in the same directory.
graph 6_8_19.png
graph 6_8_19.png (50.7 KiB) Viewed 1349 times
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Data Visualisation

Post by TerryJC »

Philipp,

Well done! That is exactly the sort of thing that we've been looking for. Can you publish your code please?

Next Step:

Referring to the Requirments that I posted when you started this:https://wmtprojectsforum.altervista.org ... %20v03.odt, can you now look into some of the other things that we were looking for:
Stretch Targets

• Highlight datapoints that lie outside calculated standard deviation values on chart.
• Identify and chart long term trends.
• Devise a means to extract the data from a database.
• Devise a means to write the data into a suitable database.
Let us know if you have any queries.
Terry
Penri
Posts: 1284
Joined: 18/05/2017, 21:28

Re: Data Visualisation

Post by Penri »

Nice work.
Philipp
Posts: 8
Joined: 14/01/2019, 15:13

Re: Data Visualisation

Post by Philipp »

The code:
First, to set the time format correctly, run these commands:

Code: Select all

set xdata time
set timefmt "%Y-%m-%d %H:%M:%S"
set datafile separator comma
set format x "%d-%m"
set format x "%d/%m, %H:%M"
This makes the program understand the time format given in the database. This will also label the axis as days/months, hours:minutes e.g. 03/8, 12:49.
The next command to run would be

Code: Select all

plot for [i=0:14] ‘data’.i.’.csv’ using 1:4 smooth bezier title ‘data set’.i
Which plots all files in the directory. These have to be named in a certain way. I renamed the files for one week “data” followed by an integer, which the for loop uses to iterate through each file. The “data” could be anything, but the integer needs to be there for this command to work.
Philipp
Posts: 8
Joined: 14/01/2019, 15:13

Re: Data Visualisation

Post by Philipp »

Hello,
just wanted to mention that the library used to make quick graphs in python is called "matplotlib".
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Data Visualisation

Post by hamishmb »

Do you want us to get matplotlib installed on the NAS box?
Hamish
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Data Visualisation

Post by TerryJC »

It wouldn't hurt, then we can decide whether to generate the plots on the NAS Box or on demand on the Webserver that provides the Staff and Visitor GUI.

Ian has the NAS Box at the moment and I expect that I'll be able to chat to him tomorrow morning when I go to WMT to install the Milk Shake Factory Train Controller.
Terry
Post Reply