Updating Y axis limits after TGraph drawn [RESOLVED]


I have several TGraphs that I draw to the same canvas. I draw the first one with the “A” draw option, and the rest without it. Sometimes, the additional TGraphs that I draw to the canvas have a different Y range than the original graph, so parts of the additional graphs are cut off.

Is there some way to update the Y axis limits after the graphs are drawn onto the canvas? I have tried using TGraph->GetYaxis()->SetLimits(), but this doesn’t seem to do anything either before or after the graphs are drawn onto the canvas. Is there some way to either update the Y axis after the graphs or drawn, or to make the Y axis have some initial value before the graphs are drawn?

Thanks for any replies. Let me know if an example will be needed, or if there’s anything else I can do to provide more information.


I just found the TGraph->SetMinimum() and TGraph->SetMaximum() functions, and these do the trick. I’m not sure why I didn’t see these before when I was looking through the API.

My problem is thus resolved. Sorry for not checking more thoroughly first.