Change y-axis range

Dear Users,

I have a very simple question on how to change the y-axis range of a histogram plot. I have tried TH1D.GetYaxis().SetRange(), TH1D.GetYaxis().SetRangeUser(), TH1D.SetMaximum but none of them have an effect on my plot. I have also tried calling these commands in different lines. Here is my code:

canvas = TCanvas("Histogram", "Histogram", 100, 200, 700, 500)
#Here is what I've tried:

Both hist1 and hist2 are TH1D objects. Does anyone know what Iā€™m doing wrong?

Try: hist1.SetAxisRange(0., 150., 'Y'); canvas.Modified(); canvas.Update()

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.