How do you adjust the TGraph2D Draw viewing angles?

When using the Draw option to output an image of a TGraph2D, there is the option to rotate the surface if you use the interactive window, but the default image output is an isometric view.

How do you control the viewing angle from the command line or using the Draw options? For example, I want to output a top-down image that hides the z-axis completely. How do I do that without having to use the mouse?

   TCanvas *c = new TCanvas("c","Graph2D example",0,0,600,400);
   Double_t x, y, z, P = 6.;
   Int_t np = 200;
   TGraph2D *dt = new TGraph2D();
   dt->SetTitle("Graph title; X axis title; Y axis title; Z axis title");
   TRandom *r = new TRandom();
   for (Int_t N=0; N<np; N++) {
      x = 2*P*(r->Rndm(N))-P;
      y = 2*P*(r->Rndm(N))-P;
      z = (sin(x)/x)*(sin(y)/y)+0.2;

Can it be that you want one of the “COLor” or “CONTour” drawing options.

Hello couet,

These two commands solved the issue:

Thank you! Is there also a Psi angle?

In TView only

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.