Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TH3 missing labels #6381

Closed
couet opened this issue Sep 18, 2020 · 2 comments
Closed

TH3 missing labels #6381

couet opened this issue Sep 18, 2020 · 2 comments
Assignees
Labels
Milestone

Comments

@couet
Copy link
Member

couet commented Sep 18, 2020

Describe the bug

the attached TH3 has two missing labels. Note that changing the diction to "not optimise" makes them appear.

Expected behavior

The two missing labels should be displayed.

To Reproduce

{
  f = new TFile("th3_label.root”);
  h3->Draw();
  cout << h3->GetXaxis()->GetNbins() << endl;
  h3->GetXaxis()->GetLabels()->ls();
}

The root file is th3_label.log (renamed . log to be able to attach it).

@couet couet added the bug label Sep 18, 2020
@couet couet self-assigned this Sep 18, 2020
@couet
Copy link
Member Author

couet commented Sep 18, 2020

A reproducer. A simple macro. Is:

void testTH3Label() {

   TRandom3 r;
   int nBins = 3;
   int nEvents = 100000;
   double minRange = 1; double maxRange = 5;
   TH3D* h4 = new TH3D("h4", "h4-Title",
                       2*nBins, minRange, maxRange,
                       nBins , minRange, maxRange,
                       nBins , minRange, maxRange);

   std::vector<TString> labels = {"a1","b1","c1","a2","b2","c2"};
   for ( Int_t e = 0; e < nEvents; ++e ) {
      TString label = labels[r.Uniform(0,labels.size())];
      Double_t x = r.Uniform(0.9 * minRange, 1.1 * maxRange);
      Double_t y = r.Uniform(0.9 * minRange, 1.1 * maxRange);
      Double_t z = r.Uniform(0.9 * minRange, 1.1 * maxRange);
      h4->Fill(label, y, z, 1.0);
   }
   h4->Draw();
   /// h4->GetXaxis()->SetNdivisions(-1); // This line fixes the issue
   h4->GetXaxis()->GetLabels()->ls();
}

@couet
Copy link
Member Author

couet commented Sep 21, 2020

Fixed by: #6391

@couet couet closed this as completed Sep 21, 2020
@eguiraud eguiraud added this to the 6.24/00 milestone Sep 22, 2020
@couet couet added this to Issues in Fixed in 6.24/00 via automation Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

No branches or pull requests

2 participants