Skip to content

Instantly share code, notes, and snippets.

@frafra
Last active June 25, 2017 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frafra/465d18b0cedb28eda418ef54821c0305 to your computer and use it in GitHub Desktop.
Save frafra/465d18b0cedb28eda418ef54821c0305 to your computer and use it in GitHub Desktop.
gnuplot example
# Remove quotes from the input file if needed:
# $ sed -i "s/'//g" 20170623.csv
# How to use this script:
# $ gnuplot -e "filename='20170623.csv'" sensors.plot
set terminal pngcairo size 640,480 enhanced font 'Verdana,10'
set output system('basename '.filename.' .csv').'.png'
set multiplot layout 2,1 rowsfirst title filename font ",14"
set datafile separator ','
set xdata time
set timefmt '%H:%M'
set format x "%H:%M"
#set xlabel "time (%H:%M)"
set xtics rotate
set grid
set key outside
set y2tics
set ylabel "temperature (°C)"
set y2label "humidity (%)"
set rmargin at screen 403.0/640
set bmargin at screen 230.0/480
plot filename using 1:3 with lines title 'temperature' axes x1y1, '' using 0:4 with lines title 'humidity' axes x2y2
set lmargin at screen 75.0/640
set tmargin at screen 180.0/480
unset bmargin
unset ylabel
set format x ""
set xlabel ""
set y2label "pressure (mbar)"
plot filename using 0:2 with lines title 'pressure' axes x2y2 ls 3
unset multiplot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment