#include "TPad.h" void Overlap_3(){ TCanvas* c = new TCanvas("c","c",500,500); // Double_t eps = 0.005; Double_t eps = 0.2; int N = 4; // double x[4] = {0.3,0.6,0.6,0.3}; // double y[4] = {0.3,0.6,0.6,0.3}; TPad* p1 = new TPad("p1","p1",0.01,0.01,0.99,0.99,0); p1->Draw(); TPad* p2 = new TPad("p1","p1",0.1,0.1,0.9,0.9,0); p2->Draw(); p2->SetFillStyle(4000); //Pad2 is transparent //Draw rectangle regions // TPave *region= new TPave(0.3,0.3,0.6,0.6,1,"NDC"); TPave *region= new TPave(0.3,0.3,0.6,0.6,1); region->SetLineColor(kRed); region->SetLineStyle(1); region->SetLineWidth(2); region->SetFillStyle(4000); //Draw Polygon regions by user coordinates. User coordinates are equal to NDC coordinates in an empty TPad. Double_t x[5] = {.2,.7,.6,.25,.2}; Double_t y[5] = {.5,.6,.8,.7,.5}; TPolyLine *pline = new TPolyLine(5,x,y); pline->SetLineStyle(1); pline->SetLineColor(2); pline->SetLineWidth(2); pline->SetFillStyle(4000); TH1F* h1 = new TH1F("h1","",100,-2.5,2.5); TH1F* h2 = new TH1F("h2","",100,-2.5,2.5); h1->Fill(0,12000.); h2->Fill(0,1.5); p1->cd(); h1->Draw(); p2->Modified(); p2->Update(); p2->cd(); region->Draw("f"); pline->Draw(); p2->Modified(); p2->Update(); c->cd(); // p2->SetEditable(kFALSE); }