Skip to content

Instantly share code, notes, and snippets.

@larsgroeber
Created October 15, 2016 16:38
Show Gist options
  • Save larsgroeber/b9c29c8bc68a66b03571bf12592527e5 to your computer and use it in GitHub Desktop.
Save larsgroeber/b9c29c8bc68a66b03571bf12592527e5 to your computer and use it in GitHub Desktop.
#! /bin/gnuplot
set terminal wxt size 350,262 enhanced font 'Verdana,10' persist
# set terminal dumb
file="`echo $plot_file`" # make sure to set the $plot_file environment variable first
f(x) = a*x+b
a = 1
b = 1
fit f(x) file via a,b
title_f(a, b) = sprintf('f(x) = %.2f*x+%.2f', a, b) # display the final a and b values on the chart
plot f(x) t title_f(a,b), file
pause mouse keypress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment