Created
April 10, 2017 18:42
-
-
Save JavierJia/e10f7c7d8ce3c42a6e469316a5738f0f to your computer and use it in GitHub Desktop.
gnuplot histogram and normal distribution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set key left box | |
set autoscale | |
set samples 800 | |
set terminal postscript eps enhanced size 3in,3in color | |
set x2range [-10 : 8] | |
set ytics nomirror | |
set y2tics | |
set autoscale y | |
set autoscale y2 | |
invsqrt2pi = 0.398942280401433 | |
normal(x,mu,sigma)=sigma<=0?1/0:invsqrt2pi/sigma*exp(-0.5*((x-mu)/sigma)**2) | |
binwidth=0.3 | |
bin(x,width)=width*floor(x/width) | |
plot 'var.dat' using (bin($1,binwidth)):(1.0) smooth freq with boxes notitle, \ | |
normal(x,0,1.4) axes x2y2 with lines lw 2 notitle | |
# normal(x,0,1) axes x2y2 with lines lw 2 title "a good fit", \ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
set key left box
set autoscale
set samples 800
set terminal postscript eps enhanced size 3in,3in color
set x2range [-10 : 8]
set ytics nomirror
set y2tics
set autoscale y
set autoscale y2
invsqrt2pi = 0.398942280401433
normal(x,mu,sigma)=sigma<=0?1/0:invsqrt2pi/sigmaexp(-0.5((x-mu)/sigma)**2)
binwidth=0.3
bin(x,width)=width*floor(x/width)
plot 'var.dat' using (bin($1,binwidth)):(1.0) smooth freq with boxes notitle,
normal(x,0,1.4) axes x2y2 with lines lw 2 notitle