Jump to content

Using gnuplot to visualize CSV files from data logger


mpids-user
 Share

Recommended Posts

Moin, moin

 

After spending some time to figure out how to plot a file written by the Brick Viewer data logger using gnuplot, I thought I share a working template here. If you bunzip2 the attached CSV file and then run gnuplot template.plt you will obtain test.ps which shows on the left and right ordinate temperature and humidity data logged over roughly one week.

 

If you are unfamiliar with gnuplot, the template will a bit cryptic and you probably want to first tinker around with some resources such as e.g. https://www.cs.hmc.edu/~vrable/gnuplot/using-gnuplot.html or http://www.dcf.ds.mpg.de/index.php?id=1470 .

 

The main trick is to identify for each plotting command all lines which belong to a given bricklet. This is done with:

plot "test.csv" u 1:(strcol(3) eq "9i9" ? $5/100 : 1/0)

where we plot the first column (time) against the all lines coming from one specific bricklet using the (if ? then : else) operator.

 

First the string comparison (eq) compares column 3, after converting it to a string (strcol(3)), with the uid of the bricklet of interest. If the comparison is true, the y-value is set to column 5 divided by 100 (which rescales the output of a temperature bricklet to Celsius). Else the line belongs to another bricklet and the y-value is set to 1/0, which is undefined and therefore ignored. 

 

the gardener

test.csv.bz2

template.plt

test.ps

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...