#include "TGraph.h" #include "TCanvas.h" #include "TAxis.h" void test() { double x1[31] = { -150.0, -140.0, -130.0, -120.0, -110.0, -100.0, -90.0, -80.0, -70.0, -60.0, -50.0, -40.0, -30.0, -20.0, -10.0, 0.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0, 120.0, 130.0, 140.0, 150.0 }; double y1[31] = { 0.03770, 0.73601, 0.88293, 1.08505, 1.37199, 1.77793, 2.29903, 3.06789, 11.69226, 34.89852, 26.15901, 24.17154, 18.57637, 20.45682, 15.98927, 11.40050, 20.35507, 26.98080, 32.77498, 32.99087, 31.89637, 7.05873, 2.83119, 2.05663, 1.63508, 1.30273, 1.04581, 0.85808, 0.73163, 0.63467, 0.41390 }; double x2[10] = { -45.0, -35.0, -25.0, -15.0, -5.0, 5.0, 15.0, 25.0, 35.0, 45.0 }; double y2[10] = { 6.32059, 6.04524, 5.80783, -0.87045, 4.92390, 6.64423, 0.99805, 5.80580, 4.46641, 3.88979 }; TCanvas *c = new TCanvas("c"); TPad *px1 = new TPad("px1","",0,0,1,1); TPad *px2 = new TPad("px2","",0,0,1,1); px2->SetFillStyle(4000); px2->SetFrameFillStyle(0); px1->Draw(); px1->cd(); TGraph *g1 = new TGraph(31, x1, y1); g1->GetXaxis()->SetRangeUser(-150, 150); g1->SetMarkerStyle(4); g1->Draw("AP"); px2->Draw(); px2->cd(); TGraph *g2 = new TGraph(10, x2, y2); g2->GetXaxis()->SetRangeUser(-150, 150); // does not work g2->Draw("ALY+"); }