/usr/share/doc/slang-xfig/examples/histplt.sl is in slang-xfig 0.2.0~.35-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | require ("xfig");
require ("rand");
require ("histogram");
private define gauss_pdf (x, sigma)
{
return 1.0/sqrt(2*PI*sigma^2) * exp(-0.5*x^2/sigma^2);
}
public define slsh_main ()
{
variable mu = 100, sigma = 15, dx = 1.0;
variable data = mu + rand_gauss (sigma, 10000);
variable x = [min(data):max(data):dx];
variable h = hist1d (data, x)/(dx*length(data));
variable w = xfig_plot_new ();
w.world (x,h);
w.hplot (x, h; fillcolor="red", fill=20);
h = gauss_pdf (x-mu,sigma);
w.plot (x,h; color="blue");
w.xlabel ("IQ");
w.ylabel ("Probability [bin$^{-1}$]");
w.title ("IQ; $\sigma=100;\mu=15$"R);
w.render ("histplt.png");
}
|