Hi Everyone,
I wonder if there is a way to change the X and Y titles for a
TMultiGraph object which have been drawn with the “al3d” option. Here I
send a slightly modified version of the example shown in the documentation:
{
auto c0 = new TCanvas("c1","multigraph L3",200,10,700,500);
auto mg = new TMultiGraph();
auto gr1 = new TGraph(); gr1->SetLineColor(kBlue);
auto gr2 = new TGraph(); gr2->SetLineColor(kRed);
auto gr3 = new TGraph(); gr3->SetLineColor(kGreen);
auto 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;
gr1->SetPoint(i,x,2.*TMath::Sin(x));
gr2->SetPoint(i,x,TMath::Cos(x));
gr3->SetPoint(i,x,TMath::Cos(x*x));
gr4->SetPoint(i,x,TMath::Cos(x*x*x));
}
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->SetTitle("Title; XX; YY");
mg->Draw("al3d");
//mg->GetXaxis()->SetTitle("XX");
//mg->GetYaxis()->SetTitle("YY");
//gPad->Modified();
}
Note that I also tried to get a pointer to the axis to change its title
after drawing the TMultiGraph as stated in the documentation but I got
an Illegal Pointer error. Also, is there any way to specify the range
for each axis?
Any help would be appreciated,
Thanks,
Best wishes,
Andres