#include "TGraph.h" #include "TH1F.h" #include "TCanvas.h" void tmp() { double x1[5] = {0, 1, 2, 3, 4}; double y1[5] = {0, 1, 2, 3, 4}; TGraph* gra1 = new TGraph(5, x1, y1); double x2[5] = {0, 1, 2, 3, 4}; double y2[5] = {0.1, -0.4, 0.7, 0.3, -0.2}; TGraph* gra2 = new TGraph(5, x2, y2); TCanvas* can = new TCanvas("can", "", 800+4, 600+26); gPad->SetBottomMargin(0.3); TH1F* tmp = gPad->DrawFrame(0, -0.1, 5, 5); tmp->SetTitle(";;Y"); tmp->GetXaxis()->SetTickLength(0); tmp->GetXaxis()->SetLabelSize(0); gra1->Draw("* same"); TPad* pad = new TPad("pad", "", 0, 0, 1, 1); pad->SetFrameFillStyle(4000); pad->SetTopMargin(0.7); pad->Draw(); tmp = pad->DrawFrame(0, -1.5, 5, 1.5); tmp->SetTitle(";X;Residual"); tmp->GetXaxis()->SetTickLength(0.02); tmp->GetYaxis()->SetNdivisions(103); tmp->GetYaxis()->CenterTitle(); pad->cd(); gra2->Draw("* same"); }