Skip to content

Instantly share code, notes, and snippets.

@joneskoo
Created December 21, 2014 10:47
Show Gist options
  • Save joneskoo/7826d564a2b6d91e8e6f to your computer and use it in GitHub Desktop.
Save joneskoo/7826d564a2b6d91e8e6f to your computer and use it in GitHub Desktop.
Plot power consumption as a function of temperature
#!/usr/bin/env gnuplot
# sqlite3
# select cast(temp as integer), round(avg(1000*usage), 2) from power group by 1;
set terminal png
set output "data.png"
set datafile separator ","
set title "Power consumption as a function of temperature"
set ylabel "Watts"
set xlabel "Outside temperature (Celsius)"
f(x) = a*x + b
fit [-20:10] f(x) 'data.txt' using 1:2 via a,b
plot "data.txt" title "Power usage", \
f(x) title "linear fit -20..10C"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment