TBox in pad coordinates

Dear all,

I have a TPad in which I draw an histogram. Then I’d like to add a TBox defined with coordinates using the TPad as a reference. The constructor (TBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2)) seems to use the axis coordinate. How can I switch to the Pad coordinates when defining the box?
Thank you.

void box() {
   TH2F *h = new TH2F("h", "h", 10,-1.,1.,10.,-1.,1);
   h->Draw();
   gPad->Update();

   TPad *p = new TPad("p","p",0.,0.,1.,1.); p->SetFillStyle(0); p->Draw(); p->cd();
   TBox *b = new TBox(0.05,0.05,0.5,0.5); b->Draw();
}

Hi,

how difficult would it be to provide a DrawBoxNDC(...) member function similarly to DrawLineNDC(...)?

1 Like

Not too difficult I guess. You can submit a PR if you want.