int TH1exampl2.C() { TH1F *hist = new TH1F("hist","TH1 example",10,0.0,10.0); TH1F *hist1 = new TH1F("hist1","TH1 example",10,0.0,10.0); for(i=0;i<10;i++){ if(i<3) x=4; if(i>3 && i<=6) x=8; if(i>6) x=3; hist->Fill(x); hist1->Fill(i,i*i); } hist->Draw(); hist->GetXaxis()->SetTitle("x-axis"); hist->GetXaxis()->CenterTitle(); hist->GetYaxis()->SetTitle("y-axis"); hist->GetYaxis()->CenterTitle(); hist1->SetLineColor(2); hist1->Draw("same"); }