{ TCanvas *c1 = new TCanvas("c1","transparent pad"); TPad *pad1 = new TPad("pad1","",0,0,1,1); TPad *pad2 = new TPad("pad2","",0,0,1,1); pad2->SetFillStyle(4000); //will be transparent c1->SetBorderMode(0); c1->SetBorderSize(2); pad1->SetBottomMargin(0.14); pad1->Draw(); pad1->cd(); TGraphErrors *gre = new TGraphErrors(1); gre->SetName("Graph"); gre->SetTitle(""); gre->SetFillColor(1); gre->SetLineWidth(2); gre->SetMarkerStyle(20); gre->SetMarkerSize(0.7); gre->SetPoint(0,30,0.04863153); gre->SetPointError(0,0,0.003806435); gre->Draw("AP"); gre->GetXaxis()->SetTitle("Z"); gre->GetYaxis()->SetTitle("Y(Z)"); gre->GetXaxis()->CenterTitle(true); gre->GetYaxis()->CenterTitle(true); pad1->Update(); pad1->Modified(); c1->cd(); TGraphErrors *greNoZ = new TGraphErrors(1); greNoZ->SetName("greNoZ"); greNoZ->SetTitle(""); greNoZ->SetFillColor(1); greNoZ->SetLineWidth(2); greNoZ->SetMarkerStyle(20); greNoZ->SetMarkerSize(0.7); greNoZ->SetPoint(0,30,1.484217); greNoZ->SetPointError(0,0,0.0108437); //compute the pad range with suitable margins Double_t ymin = 1.35; Double_t ymax = 1.55; Double_t dy = (ymax-ymin)/0.84; //10 per cent margins top and bottom // Double_t dy = (ymax-ymin)/0.8; //10 per cent margins top and bottom Double_t xmin = 29.9; Double_t xmax = 31.1; Double_t dx = (xmax-xmin)/0.73; //10 per cent margins left and right // Double_t dx = (xmax-xmin)/0.8; //10 per cent margins left and right // pad2->Range(xmin-0.1*dx,ymin-0.1*dy,xmax+0.1*dx,ymax+0.1*dy); pad2->Range(xmin-0.12*dx,ymin-0.14*dy,xmax+0.15*dx,ymax+0.02*dy); pad2->SetBottomMargin(0.14); pad2->Draw(); pad2->cd(); greNoZ->SetLineColor(kRed); greNoZ->SetMarkerColor(kRed); greNoZ->GetYaxis()->SetTitle("/Z"); greNoZ->GetYaxis()->SetTitleSize(0.07); greNoZ->Draw("LP"); pad2->Update(); // draw axis on the right side of the pad TGaxis *axis = new TGaxis(xmax,ymin,xmax,ymax,ymin,ymax,5,"+L"); axis->SetLabelColor(kRed); axis->SetTitleColor(kRed); axis->SetLabelSize(0.06); axis->SetTitleFont(42); axis->SetTitleOffset(0.9); axis->SetTitle("/Z"); axis->CenterTitle(true); axis->SetTitleSize(0.07); axis->Draw(); }