Skip to content

Conversation

@rlalik
Copy link
Contributor

@rlalik rlalik commented Jan 7, 2026

When using PADS drawing option, now one can add number specyfiing number of columns for new pads layout. Rows will be calculated autmatically.

Some examples:

auto make_hist(const char * name, const char * title, const char * f, int n_data) -> TH1I* {
    const int grad = 4;

    auto h = new TH1I(name, title, 20, -5, 5);

    for (int i = 0; i < n_data; ++i) {
        h->FillRandom(f, n_data);
    }
    h->SetLineColor(1);

    return h;
}

void demo() {
    gStyle->SetPalette(kRainBow);

    auto h1 = make_hist("Grupa 1", "Grupa 1;Punkty;Liczba", "gaus", 190);
    auto h3 = make_hist("Grupa 3", "Grupa 3;Punkty;Liczba", "gaus", 200);
    auto h4 = make_hist("Grupa 4", "Grupa 4;Punkty;Liczba", "gaus", 170);

    auto hs = new THStack();

    hs->Add(h1, "");
    hs->Add(h3, "");
    hs->Add(h4, "");

    auto can = new TCanvas("can", "can", 800, 400);
    can->Divide(2, 1);

    can->cd(1);
    hs->Draw("pfc");

    can->cd(2);
    hs->Draw("PADS3");
}
hist_can_pads3

When changing the last but one line to:

hs->Draw("PADS1");
hist_can_pads1

and backward comaptibility:

hs->Draw("PADS");
// or
hs->Draw("PADS2");
hist_can_pads

Same for graphs:

{
   auto mg  = new TMultiGraph();

   auto gr1 = new TGraph(); gr1->SetMarkerStyle(20);
   auto gr2 = new TGraph(); gr2->SetMarkerStyle(21);
   auto gr3 = new TGraph(); gr3->SetMarkerStyle(23);
   auto gr4 = new TGraph(); gr4->SetMarkerStyle(24);

   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,"PL");
   mg->Add(gr3,"PL");
   mg->Add(gr2,"*L");
   mg->Add(gr1,"PL");

   mg->Draw("A pmc plc pads3");
}
graph_can_pads3

This does not work with --web=on (Web Canvas) but I am not good enough in JS to fix that. But PADS seems to not work nicely with the web interface anyway. Perhaps it could be fixed - PADS in general and PADSn for this PR. @linev could you help with that?

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

This PR fixes #

When using PADS drawing option, now one can add number specyfiing number of columns for new pads layout. Rows will be calculated autmatically.
@rlalik rlalik requested a review from hageboeck as a code owner January 7, 2026 17:33
@ferdymercury
Copy link
Collaborator

a bit related: #20770

Copy link
Member

@hageboeck hageboeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @rlalik,

that's a great initiative, thank you!

I added a few comments below, please let me know what you think.

Finally, because now we are touching it, would you agree that a short paragraph about the PADS drawing option would make sense for TMultiGraph? One could add it maybe to the TMultiGraph documentation. What do you think?

@hageboeck hageboeck self-assigned this Jan 8, 2026
@rlalik
Copy link
Contributor Author

rlalik commented Jan 9, 2026

Finally, because now we are touching it, would you agree that a short paragraph about the PADS drawing option would make sense for TMultiGraph? One could add it maybe to the TMultiGraph documentation. What do you think?

I added short documentation to TMultiGraph.

Copy link
Member

@hageboeck hageboeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot! The update of the documentation is amazing. Let's build and see what the CI says!

Update: I think we can ignore the clang-format failure. Trying to format the doxygen comments does more harm than good, I believe.

Implementation of review suggestions plus extra documentation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants