Introduction
Gnuplot has a solution for creating a histogram from a file called hist.dat , which is like
1 2 2 2 3
using commands
binwidth=1 set boxwidth binwidth bin(x,width)=width*floor(x/width) + binwidth/2.0 plot [0:5][0:*] "hist.dat" u (bin($1,binwidth)):(1.0) smooth freq with boxes
which generates a histogram like this from another SO page .
Question
How can I put my function on this histogram? I defined a Gaussian function and initialized its values ββto
f(x) = a*exp(-((xm)/s)**2) a=3; m=2.5; s=1
and the output function is well suited to the histogram.
Unfortunately, I cannot approach this histogram using the command
fit f(x) "hist.dat" u (bin($1,binwidth)):(1.0) smooth freq via a,m,s ^ Need via and either parameter list or file
So how can I put my function without creating a new file containing binned values?
source share