I have a canvas with a TGraph drawn. I would like to get its zoom ranges and apply to a next graph which will be drawn in the same canvas. It seems that I can get the ranges only with gPad.GetUymin/max(). GetMaximum() on graph returns the pre-zoom maximum of the graph, GetFirst/Last() on axis returns always 1 and so on…
However, I cannot find anywhere a method to set the Pad zooms, like SetUymin/max(). Setting TGraph.SetMaximum() would work, but then the values of min/max would be stored elsewhere then those accessible by gPad.GetUymin/max(). What should I do?
Doesn’t work. I draw graph from the TTree, than try to use it, but no change. Somehow the Graph and what is drawn are living separate lives:
self.etosTree.Draw("avg_pc_data[" + str(pix_num) + "]:threshold>>pixgraph(100, -1, -1, 100000, -1, -1)", "avg_pc_data[" + str(pix_num) + "]<0.1*100", "*")
In case of a tree drawing, the axis are defined with a TH2F.
The graph is plotted on top of it as you can see from gPad->ls():
root  gPad->ls()
Canvas Name=c1 Title=c1 Option=
TCanvas fXlowNDC=0 fYlowNDC=0 fWNDC=1 fHNDC=1 Name= c1 Title= c1 Option=
OBJ: TList TList Doubly linked list : 0
TFrame X1= -4.500000 Y1=-4.500000 X2=5.000000 Y2=5.000000
OBJ: TH2F htemp px:py : 1 at: 0x7fdc2c6f9df0
OBJ: TPaveText title X1= -0.414727 Y1=5.475000 X2=0.914727 Y2=6.128125
OBJ: TGraph Graph Graph : 1 at: 0x7fdc2c7173c0
To change the axis limits you should change htemp:
TH2F *h = gPad->GetPrimitive("htemp");