Draw with "X+" and "Y+" not working for TMultiGraph

Dear developers,
The draw options “Y+” and “X+” (either alone or combined) to put the axis ticks and labels on the right and top sides do not seem to work for TMultiGraph, only for TGraph. Small example:

{
  auto c0 = new TCanvas("c1","c1",200,10,700,700);
  c0->Divide(1,2);

  auto mg1 = new TMultiGraph();
  auto gr1 = new TGraph(); gr1->SetLineColor(kBlue);
  auto gr2 = new TGraph(); gr2->SetLineColor(kRed);

  Double_t dx = 6.28/1000;
  Double_t x  = -3.14;
  for (int i=0; i<=1000; i++) {
     x = x+dx;
     gr1->SetPoint(i,x,2.*TMath::Sin(x));
     gr2->SetPoint(i,x,TMath::Cos(x));
  }
  mg1->Add(gr1);
  //mg1->Add(gr2);

  c0->cd(1);
  gr1->SetTitle("graph with ALX+Y+");
  gr1->Draw("alX+Y+");

  c0->cd(2);
  mg1->SetTitle("multigraph with ALX+Y+");
  mg1->Draw("alX+Y+");
}

results in


ROOT Version: 6.26/06, 5.34/38 (all versions?)
Platform: At least Ubuntu 20.04, Ubuntu 22.04, Windows 10


Yes, this two options are are simply not implemented for TMutigraph. Do you want to create an Github issue with that in order to not forget it ?

Just did it. I wasn’t sure under what category, so I chose “feature request” :slight_smile:

1 Like

Thanks ! yes that’s the good category.

The PR is ready: Option X+ and Y+ for TMultiGraph by couet · Pull Request #11298 · root-project/root · GitHub

With this PR your macro produces this plot:

The “I” option was also missing in TMultiGraph. I added it.

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