SetNoExponent for TMultiGraph x-axis

Hi,

Please could you tell me how to switch off the exponent for the x-axis of a TMultiGraph? I’m creating it in a python script, its constituent TGraphs were made using SetNoExponent() and they display correctly, but the multigraph is displayed using an exponent. In my python script, mg.GetXaxis().SetNoExponent() has no effect.

I’d also be interested in switching it off in JSROOT as a workaround as that’s what I’m using to display the graphs.

Thanks for any suggestions,
Naomi.

Try adding gPad.Modified() and gPad.Update() after drawing. The below works, unless you remove those lines:

{
  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/1000;
  Double_t x  = -3.14, xg = 1.0e3;

  for (int i=0; i<=1000; i++) {
    x = x+dx;
    xg = xg + 10*i;
    gr1->SetPoint(i,xg,2.*TMath::Sin(x));
    gr2->SetPoint(i,xg,TMath::Cos(x));
    gr3->SetPoint(i,xg,TMath::Cos(x*x));
    gr4->SetPoint(i,xg,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("Multi-graph Title; X-axis Title; Y-axis Title");

  mg->Draw("a l");
  mg->GetXaxis()->SetNoExponent();

  gPad->Modified();
  gPad->Update();
}

Hi, I applied SetNoExponent to the multigraph later on - after the graphs had been added to it - and that fixed the problem. Thanks for the inspiration!
Naomi.