Problem with TLine and resizing of x-axis

Basic primitives such as Tline, TText do not know about the frame created when drawing histograms and graphs.
In your case simply replace Tline by TGraph as show below

Rene

{ TH1D *hist = new TH1D("histName","histTitle",10,0.,10.); hist->GetYaxis()->SetRangeUser(0.,2.); //TLine *line = new TLine(0.,1.,10.,1.); TGraph *line = new TGraph(2); line->SetPoint(0,0,1); line->SetPoint(1,10,1); line->SetLineColor(kRed); hist->Draw(); line->Draw("l"); }

1 Like