User Tools

Site Tools


root:setaxisrange

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
root:setaxisrange [2011/05/11 15:35] – added solution for my latest problem nchiaproot:setaxisrange [2012/08/15 11:57] – added info for THStack nchiap
Line 8: Line 8:
  
 ===== Y Axis of a normalized Histogram ===== ===== Y Axis of a normalized Histogram =====
-Assume you have a histogram which has been normalized it with **hist->SetNormFactor(1)**. +Assume you have a histogram which has been normalized it with  
-When your Y-axis will show values between 0 and 1.  +<code c++> 
-Trying to set the Y range using these values, eg. **SetRangeUser(0.01, 0.2)**, will fail however.+hist->SetNormFactor(1) 
 +</code> 
 +Your Y-axis will show values between 0 and 1.  
 +Trying to set the Y range using these values, eg.  
 +<code c++>SetRangeUser(0.01, 0.2)</code> 
 +will fail however.
 You still need to give the range in the original unnormalized units. You still need to give the range in the original unnormalized units.
  
Line 18: Line 23:
 hist->GetYaxis()->SetRangeUser(normalizedLower*scaleY,normalizedUppe*scaleY); hist->GetYaxis()->SetRangeUser(normalizedLower*scaleY,normalizedUppe*scaleY);
 </code> </code>
 +
 +===== Y Axis of a THStack =====
 +Do not try to ''SetLimits'' or ''SetRangeUser'' of any histogram.
 +Instead use the following code:
 +<code c++>
 +THStack *hs = new THStack("hs","test stacked histograms");
 +hs->SetMinimum(0.);
 +hs->SetMaximum(10.);
 +</code>
 +
  
 ===== X Axis of TGraph ===== ===== X Axis of TGraph =====
root/setaxisrange.txt · Last modified: 2014/03/11 10:20 by nchiap