SetRangeUser is not working for TGraph

Hello,

For some reason, SetRangerUser is not working when I’m using TGraph. I’m writing out my code in this way, which works for histogram classes.

TGraph *g1 = new TGraph();
g1->GetYaxis()->SetRangeUser(0,1);

I’ve looked at other forums that discusses the same problem, but it’s still not working. I also want to do this for multiple graphs that be drawn on to the same canvas. So, do I have to do it for one graph or for all of my graphs? Hope to hear a response soon. Thanks in advance.

-Charlie Clark

ROOT Version: 6.26/06
Platform: MacOS
Compiler: C++


For the y-axis, use SetMinimum/Maximum:

g1->SetMinimum(0);
g1->SetMaximum(1);

or you can also do:

g1->GetHistogram()->GetYaxis()->SetRangeUser(0,1);

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