Hello everybody,
I am trying to produce a nice plot of a Lorenz attractor, using TPolyLine3D. The plot itself is pretty easy to produce, but I have a hard time controlling the aspect of the axis, as well as the view angle… Here is the code :
[code]{
gROOT->Reset();
double beta = 4.; double sigma = 10.; double rho = 35.;
double x0 = 1.; double x=x0;
double y0 = 1.; double y=y0;
double z0 = 1.; double z=z0;
double pas = 0.002;
int npoints=10000;
TPolyLine3D *courbe = new TPolyLine3D(npoints);
// create and open a canvas
TCanvas *canvas = new TCanvas( "canvas", "Lorenz", 300, 10, 700, 500 );
// creating view
TView *view = new TView(1);
view->SetRange( -10., -30., -50., 50., 50., 50. );
gStyle->SetAxisColor(1,"xyz");
gStyle->SetLabelColor(1,"xyz");
gStyle->SetFillColor(0);
gStyle->SetLabelSize(0.03, "xyz");
view->UseCurrentStyle();
view->SetLatitude(77.);
view->SetLongitude(-165.);
view->SetPsi(0.);
for( int i = 0; i < npoints; i++ )
{
// compute next point and add it to the line
double x_dot, y_dot, z_dot;
x_dot = - beta*x + y*z;
y_dot = sigma*(z-y);
z_dot = -x*y+rho*y -z;
x = x0 + pas * x_dot; x0 = x;
y = y0 + pas * y_dot; y0 = y;
z = z0 + pas * z_dot; z0 = z;
courbe->SetPoint( i, x, y, z );
}
courbe->SetLineWidth( 1 );
courbe->SetLineColor(1);
courbe->Draw();
view->ShowAxis();
canvas->Update();
}[/code]
I want to have the axis in black. This is why I tried to change the gStyle, but it doesn’t work…
Plus the SetLatitude command has zero effect on the final display… Am I missing something stupid ?
Thank you for your help !!