For the y-axis no problem. However, for the x-axis it do not change whatever values I put in the comand GetXaxis. I am writing something wrong in the code. The plot is on log scale on the x-axis.
Best regards and thank you for your time, Alessandro Calamida.
I do not have an histogram. This is a TGraphError plot. I set the range of the axis as the manual says. Unfortunately for the x-axis they do not change, whatever value I put in it.
I see the second method in the linked HowTo. However, it is just mentioned as an alternative, while I think it is fair to specify it is as the only working option for “unzooming”.
Also, as far as I understand, it makes drawing wider range from the canvas interface after the graph is drawn impossible?
I don’t know the implementation details and why it is impossible to unzoom with TGraph’s TAxis, while it works with TH1’s TAxis but I think it would be nice to have consistent behaviour with both. As it is very confusing for newbies and not only.
Would it be possible to overload the SetRange() behaviour to call back to DrawFrame() in case of the TGraph?
Actually, for “graphs”, it is very easy to use any “arbitrary values” for the x-axis range: graph->GetHistogram()->GetXaxis()->SetLimits(xmin, xmax);
ah, you are right. I got confused, because for histograms the drawing range is set to the initially specified bin range (-4, 4), independently if there is any data or not in the drawing range.
So I didn’t even noticed this limitation for histograms.
While for the TGraph range is always re-adjusts between x_min/x_max of the data points.
Which becomes very noticable if one tries to plot 100 scan plots within same x/y range, which doesn’t work out of the box as for the histograms, but requires preliminary c->DrawFrame()