require ("grace"); require ("histogram"); require ("gslrand"); define slsh_main () { variable n = 500, sigma = 2, dx = 0.2; variable data = ran_gaussian (sigma, n); variable x = [min(data):max(data):dx]; variable h = hist1d (data, x); variable y = dx * n * gaussian_pdf (x,sigma); variable g = grace_new (); g.multi (2,1;sizes=[3,1],vgap=0); g.focus(1,1); g.hplot (x,h,sqrt(h); sym=0,color="blue2",errbar_color=6, fillpat=10,dropline,fill=2,fillcolor="cyan"); g.oplot (x,y;color=2,line=1); g.title ("Simple residual plot"); g.ylabel ("Counts/bin"); g.focus(2,1); g.plot (x, h-h); g.oplot(x, h-y, sqrt(h); sym=-3,color=4, symfill=1, symsize=0.5, errbar_size=0,errbar_color=6); g.xlabel ("X"); g.save ("/tmp/residual.ps"); }