ROOT Version: 6.28/00 Platform: Linux Compiler: g++ 10.2.1-6
Hello.
I’m trying to set the y-axis of my TMultiGraph, but when the canvas being drawn on is divided, the specified axis with SetRangeUser doesn’t apply. Commenting out c1.cd(2) makes the below code work (but of course, in my actual application, i have something else drawn on pad 1). As indicated by the commented out lines, i tried a few alternatives that showed up by searching the forum, but none had any effect.
Thanks couet, it seems that works. The only difference here is using gPad instead of c1. Is there some logic behind this?
As a bonus point, the canvas currently draws the graph with automatic axes first, then adjusts the canvas and re-draws it, resulting in the canvas flickering. As you can see, my code is in a loop and visually it would make it easier to parse (comparing plots between iterations) if it didn’t do this. Is there a way to stop that happening? It seems as though both Modified and Update calls are required to make the graph properly adjust its axes, but i’m not sure how else to ‘freeze’ the canvas until the range is fixed.
That works too! Thanks again couet.
I was under the impression the histogram of a TGraph didn’t exist until it was drawn, so the histogram properties couldn’t be set until that point. Perhaps adding it to the TMultigraph triggers the creation of the histogram as well?
Indeed mg->GetHistogram() does the jobs. If the histogram exists, it returns it, if not it creates it and returns it. As all the GetHistogram() methods in ROOT.