void twohist2() { TCanvas *c1 = new TCanvas("c1"); TH1F *h1 = new TH1F("h1","h1",10,-3,3); h1->FillRandom("gaus",10000); c1->DrawFrame(h1->GetXaxis()->GetXmin(), h1->GetMinimum(), h1->GetXaxis()->GetXmax(), h1->GetMaximum()); TExec* ex1 = new TExec("ex1","gStyle->SetErrorX(0.0);"); ex1->Draw(); h1->Draw("PE SAME"); TCanvas *c2 = new TCanvas("c2"); Double_t x[] = {-3,-2,0,2,3}; TH1F *h2 = new TH1F("h2","h2",4,x); h2->FillRandom("gaus",10000); c2->DrawFrame(h2->GetXaxis()->GetXmin(), h2->GetMinimum(), h2->GetXaxis()->GetXmax(), h2->GetMaximum()); TExec* ex2 = new TExec("ex2","gStyle->SetErrorX(0.5);"); ex2->Draw(); //h2->GetListOfFunctions()->Add(ex2); h2->Draw("PE"); }