I am trying to add background to my scatterplot, but the background should be limited to just the pad, I tried working based on below documentation,
https://root.cern/doc/master/img2pad_8C.html
But my original image get cropped. I didn’t quiet figure out about the x, y coordinate used in pad.
TImage *img = TImage::Open("file1545.jpg");
img->SetConstRatio(kFALSE);
float d =0.40;
TCanvas* maincanvas = new TCanvas("maincanvas","img",1080,1920);
// TPad *p1 = new TPad("i1","i2",0.05,0.55,0.05+d*img->GetWidth()/img->GetHeight(),0,95);
// TPad *p2= new TPad("i1","i2",0.05,0.55,0.05+d*img->GetWidth()/img->GetHeight(),0,95);
TPad *p1 = new TPad("i1","i2",0.05,0.55,0.9,0.9);
TPad *p2= new TPad("i1","i2",0.05,0.55,1.0,1.0);
p2->SetFillStyle(4000);
p2->SetFillColor(0);
p2->SetFrameFillStyle(0);
p2->SetFrameFillColor(0);
p1->Draw();
p1->cd();
img->Draw();
maincanvas->cd();
p2->Draw();
p2->cd();