# SetAxisRange(0.0,1.0,"Y"); is ineffective

**URL:** <https://root-forum.cern.ch/t/setaxisrange-0-0-1-0-y-is-ineffective/14040>\
**Category:** ROOT\
**Created:** [March 24, 2012, 7:15am UTC](https://root-forum.cern.ch/t/setaxisrange-0-0-1-0-y-is-ineffective/14040 "2012-03-24T07:15:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nocloud](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/n/51bf81/32.png) [@nocloud](https://root-forum.cern.ch/u/nocloud)\
**Post date:** [March 24, 2012, 7:15am UTC](https://root-forum.cern.ch/t/setaxisrange-0-0-1-0-y-is-ineffective/14040/1 "2012-03-24T07:15:32Z")

</div>

I am trying to draw 4 histograms on the same canvas.

When I do this:  
input\_hist1-\>SetAxisRange(0.0,1.0,“Y”);

This call is absolutely ineffective. It does nothing with the Y axis range. How do you set the Y axis range?

---

<div class="post-metadata">

**Author:** ![nocloud](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/n/51bf81/32.png) [@nocloud](https://root-forum.cern.ch/u/nocloud)\
**Post date:** [March 24, 2012, 7:25am UTC](https://root-forum.cern.ch/t/setaxisrange-0-0-1-0-y-is-ineffective/14040/2 "2012-03-24T07:25:06Z")

</div>

Okay, I figured it out, it is utterly retarded, SetAxisRange has to be called after you call Scale or it doesn’t work.

This is probably a bug, it shouldn’t matter when Scale is called.

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [April 11, 2012, 9:43am UTC](https://root-forum.cern.ch/t/setaxisrange-0-0-1-0-y-is-ineffective/14040/3 "2012-04-11T09:43:26Z")

</div>

[root.cern.ch/drupal/content/how-set-ranges-axis](http://root.cern.ch/drupal/content/how-set-ranges-axis)

---

<div class="post-metadata">

**Author:** ![Pepe\_Le\_Pew](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pepe_le_pew/32/12365_2.png) [@Pepe\_Le\_Pew](https://root-forum.cern.ch/u/Pepe_Le_Pew)\
**Post date:** [April 11, 2012, 10:26am UTC](https://root-forum.cern.ch/t/setaxisrange-0-0-1-0-y-is-ineffective/14040/4 "2012-04-11T10:26:24Z")

</div>

From my experience … for a TH1 I am usually using something like this:  
histo-\>Draw();  
histo-\>SetAxisRange(xmin, xmax, “X”);  
histo-\>SetAxisRange(ymin, ymax, “Y”);  
histo-\>Draw(); // make sure it’s redrawn  
If I am dealing with a THStack of several TH1 histograms, I am usually using something like this:  
stack-\>Draw(“H”);  
stack-\>GetXaxis()-\>SetLimits(xmin, xmax);  
stack-\>SetMinimum(ymin);  
stack-\>SetMaximum(ymax);  
stack-\>Draw(“H”); // make sure it’s redrawn
