diff options
Diffstat (limited to 'Master/texmf-dist/doc/asymptote/examples/histogram.asy')
-rw-r--r-- | Master/texmf-dist/doc/asymptote/examples/histogram.asy | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/asymptote/examples/histogram.asy b/Master/texmf-dist/doc/asymptote/examples/histogram.asy new file mode 100644 index 00000000000..ec00d6638d1 --- /dev/null +++ b/Master/texmf-dist/doc/asymptote/examples/histogram.asy @@ -0,0 +1,19 @@ +import graph; +import stats; + +size(400,200,IgnoreAspect); + +int n=10000; +real[] a=new real[n]; +for(int i=0; i < n; ++i) a[i]=Gaussrand(); + +draw(graph(Gaussian,min(a),max(a)),blue); + +// Optionally calculate "optimal" number of bins a la Shimazaki and Shinomoto. +int N=bins(a); + +histogram(a,min(a),max(a),N,normalize=true,low=0,lightred,black,bars=false); + +xaxis("$x$",BottomTop,LeftTicks); +yaxis("$dP/dx$",LeftRight,RightTicks(trailingzero)); + |