[metapost] drawing a beta-distribution?
Martin Kaffanke
technik at roomandspace.com
Sat Jan 12 18:14:15 CET 2008
Am Freitag, den 11.01.2008, 11:30 +0100 schrieb Ph. Ivaldi:
> I think Asymptote, the younger brother of Metapost, can do this job
> more
> simply:
That's great!
I could customize that for my needs except that I want to have the
numbers on the axis in my default latex font size?
Thanks,
Martin
> 8<------8<------8<------8<------8<------8<------8<------8<------8<------
> import graph;
> unitsize(10cm,3cm);
>
> typedef real realfcn(real);
>
> realfcn betaDistribution(real alpha, real beta){
> return new real(real x){
> return gamma(alpha+beta)/(gamma(alpha)+gamma(beta))*
> x^(alpha-1)*(1-x)^(beta-1);
> };
> };
>
> real[][] ab=new real[][] {{0.5,0.5}, {5,1}, {1,3}, {2,2}, {2,5}};
> pen[] p=new pen[] {0.8*red, 0.8*green, 0.8*blue, 0.8*magenta, black};
>
> for (int i=0; i < 5; ++i) {
> draw(graph(betaDistribution(ab[i][0],ab[i][1]),1e-5,1-1e-5), bp+p[i],
> legend="$\alpha="+(string)ab[i][0]+
> ",\;\beta="+(string)ab[i][1]+"$");
> }
>
> xlimits(0,1,Crop);
> ylimits(0,2.6,Crop);
>
> xaxis("$x$",BottomTop,linewidth(bp),Ticks);
> yaxis("$y$",LeftRight,linewidth(bp),Ticks(Step=0.2));
>
> attach(scale(0.75)*legend(linelength=3mm),point(N),5S);
> shipout(format="pdf");
> 8<------8<------8<------8<------8<------8<------8<------8<------8<------
> Result here: http://cjoint.com/?bllrlSAqM2
>
--
Ihr Partner für Webdesign, Webapplikationen und Webspace.
http://www.roomandspace.com/
Martin Kaffanke +43 650 4514224
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://tug.org/pipermail/metapost/attachments/20080112/10c585f3/attachment.bin
More information about the metapost
mailing list