TMultiGraph 3D option set axis range

As per the reference for TMultiGraph, I am trying to set the limits of the Y axis when drawn with 3D option, i.e.

 mg->Draw("a fb l3d");

I have tried all methods described in the reference manual for plotting TMultiGraph in 2D mode, which work for 2D mode,but not 3D display.

Here is my sample macro. I am trying to set the Y axis (-0.5,0.5)

void testMultiGraph()
  TCanvas *c0 = new TCanvas("c1","multigraph L3",200,10,700,500);
  TMultiGraph *mg = new TMultiGraph();
  TGraph *gr1 = new TGraph(); gr1->SetLineColor(kBlue);
  TGraph *gr2 = new TGraph(); gr2->SetLineColor(kRed);
  TGraph *gr3 = new TGraph(); gr3->SetLineColor(kGreen);
  TGraph *gr4 = new TGraph(); gr4->SetLineColor(kOrange);
  Double_t dx = 6.28/100;
  Double_t x  = -3.14;
  for (int i=0; i<=100; i++) {
    x = x+dx;
  mg->Add(gr4); gr4->SetTitle("Cos(x*x*x)"); gr4->SetLineWidth(3);
  mg->Add(gr3); gr3->SetTitle("Cos(x*x)")  ; gr3->SetLineWidth(3);
  mg->Add(gr2); gr2->SetTitle("Cos(x)")    ; gr2->SetLineWidth(3);
  mg->Add(gr1); gr1->SetTitle("2*Sin(x)")  ; gr1->SetLineWidth(3);
  mg->Draw("a fb l3d");

//  Does not work
//  mg->SetMinimum(-0.5);
//  mg->SetMaximum(0.5);
//  Does not work
//  mg->GetYaxis()->SetRangeUser(-0.5,0.5);
//  Does not work
//  mg->GetHistogram()->SetMinimum(-0.5);
//  mg->GetHistogram()->SetMaximum(0.5);

There probably is a simple over-site by me

Yes i confirm that, for the time being, the min and max values are computed each time the multigraph is drawn in 3D. Even setting individual maximum for each graph does not work.

It is done here

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