In the Divided TCanvas, How can I change the stats respectively, for example, remove the Entries?


Please read tips for efficient and successful posting and posting code

Please fill also the fields below. Note that root -b -q will tell you this info, and starting from 6.28/06 upwards, you can call .forum bug from the ROOT prompt to pre-populate a topic.

ROOT Version: 6.30
Platform: win10
Compiler: vc++


In the Divided TCanvas, How can I change the stats respectively, for example, remove the Entries?

Add

gStyle->SetOptStat(1101);

to your macro (see the options in the Documentation). Note that it affects all pads, cannot be set for each histogram. If you want different for each one, you can create your own stats boxes or edit “by hand” (see here).

I can do it in single TCanvas, but I can not do it in TCanvas which be seperated to two or more.

{
  gStyle->SetOptStat(1101);
  auto c1 = new TCanvas("c1","c1",900,450);
  c1->Divide(2,1);
  c1->cd(1);
  auto h1 = new TH2F("h1","H 1",20,-4,4,20,-20,20);
  h1->SetLineColor(kRed);
  float px, py;
  for (Int_t i = 0; i < 25000; i++) {
    gRandom->Rannor(px,py);
    h1->Fill(px,5*py);
    h1->Fill(3+0.5*px,2*py-10.,0.1);
  }
  h1->Draw("COLZ");
  c1->cd(2);
  auto h2 = new TH2F("h2","H 2",20,-4,4,20,-20,20);
  for (Int_t i = 0; i < 15000; i++) {
    gRandom->Rannor(px,py);
    h2->Fill(px,5*py);
    h2->Fill(3+0.5*px,2*py-10.,0.1);
  }
  h2->Draw("COLZ");
}

How to add “test = 10” in the divided TCanvas?
I can add it in single TCanvas, but I do not know how to add it to divided TCanvas.

You mean a simple text “test = 10” ?

You van use TText

I mean how add “test = 10” in a divided TCanvas(for example, divide(2,1))?
I can add "test = 10 " in a single TCanvas(No divided).
But I don’t know how to do it in divided TCanvas.

What to you mean be “add test = 10” ?

How do you add it on a single canvas ?

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