[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
9.6.9 Quaternary plot sample
C++ code
mglData x(50),y(50),z(50),rx(10),ry(10), a(20,30); a.Modify("x*y*(1-x-y)^2*30"); x.Modify("0.25*(1-x)*(1+cos(2*pi*x))"); y.Modify("0.25*(1-x)*(1+sin(2*pi*x))"); z.Modify("x"); gr->Text(mglPoint(0,1.3), "Quaternary plot (x+y+z+t=1)"); gr->Rotate(60,70); gr->Light(true); gr->Ternary(2); gr->SetCut(true); gr->Plot(x,y,z,"r2"); gr->Surf(a,"#"); gr->Axis(); gr->Grid(); gr->Box(); gr->SetRotatedText(false); gr->Label('t',"A",1); gr->Label('x',"B",1); gr->Label('y',"C",1); gr->Label('z',"D",1);
MGL code
new x 50:new y 50:new z 50:new a 20 30 modify a 'x*y*(1-x-y)^2*30' modify x '0.25*(1-x)*(1+cos(2*pi*x))' modify y '0.25*(1-x)*(1+sin(2*pi*x))' text 0 1.3 'Quaternary plot (x+y+z+t=1)' rotate 60 70:light on ternary 2:cut on plot x y z 'r2':surf a '#' axis:box:grid rotatetext off tlabel 'A' 1:xlabel 'B' 1 ylabel 'C' 1:zlabel 'D' 1
Pure C code
TO BE DONE
Fortran code
TO BE DONE
Python
x, y, z, a = mglData(50), mglData(50), mglData(50), mglData(20,30); a.Modify("x*y*(1-x-y)^2*30"); x.Modify("0.25*(1-x)*(1+cos(2*pi*x))"); y.Modify("0.25*(1-x)*(1+sin(2*pi*x))"); z.Modify("x"); gr.Text(mglPoint(0,1.3), "Quaternary plot (x+y+z+t=1)"); gr.Rotate(60,70); gr.Light(True); gr.Ternary(2); gr.SetCut(True); gr.Plot(x,y,z,"r2"); gr.Surf(a,"#"); gr.Axis(); gr->Grid(); gr.Box(); gr.SetRotatedText(0); gr.Label('t',"A",1); gr.Label('x',"B",1); gr.Label('y',"C",1); gr.Label('z',"D",1);