I have a TGraph that spans at Y values, for example, from 0 to 10. It has features on level of 1, but also on level of 0.01. The problem is, that when I draw the whole graph, I cannot zoom below, let’s say, 0.1. To see the small features, I have to draw only the part of TGraph with small values. However, I often would like to see “big” features and be able to zoom to see “small” features. Is there a way to extend the TGraph zooming capabilities?
Can you use LOGY axis? or do you need a linear scale?
By zoom feature, do you want both 1.0 and 0.1 to be on the plot at the same time?
I cannot use Log scale in this case.
What do I want to see? Two scenarios:
- A peak spanning from, let’s say, 1.0 to 5.0 on Y scale
- After zooming, other peak spanning from 0.01 to 0.02 on Y scale
So I want to be able to see the second peak only after zooming (it is too small to be seen in linear scale when I see the first, large peak), but the TGraph prevents me from zooming that much.
Ohh, I think you are encountering a problem between the Keyboard and Chair
This of course assuming that you are zooming in by hand.
I believe you are trying to zoom in to 0 - 1, right away. ROOT has a problem with that, it cannot do single zooms that are very small (high zoom). Instead make a larger zoom of 0-2, and then another zoom from 0-0.5.
Or right click on the axis and select SetUserRange, and set 0 to 1 or whatever.
I suspected that at the beginning, so tried SetRange. Does not work for small ranges…
SetRange does not work, at least not using the values of the axis.
You need to use SetRangeUSER, or SetUserRange.
Yes, I ment SetRangeUser. It zooms up to a point, not as much as I want it to.
Don’t know, I still suspect user error.
I take IV curves, where the current is measured down to 0.0005uA, and highest is plotted at around 80uA, and I can zoom in just fine on a linear scale, though I do need to zoom, like 5-8 times because 0.001 is so small.
Thanks, you have pointed me in the direction where the error is.
So when I draw the TGraph from TTree, I cannot zoom to small values. When I save the TGraph to a separate file, then open it and draw, I can zoom without a problem.
So… Is there any way to force the TGraph drawn from TTree to behave as a standard TGraph?
That’s weird, I know nothing about this.
Maybe TGraph needs to be rebinned or something… no idea.
I attach a TTree and a TGraph saved after printing from the tree.
Please try on the calibration_1.root:
tcal->Draw("avg_pc_data:threshold", "", "*")
To SetRangeUser from 0 to 0.002, and the same on Graph from graph.root. In the case of TTree it shows range from 0 to about 1.2, does not want to zoom in further.
graph.root (4.38 KB)
calibration_1.root (105 KB)
Seems to me I can zoom. I did:
I can also zoom on TGraph from the graph.root. Can you zoom on the graph directly drawn from TTree? I cannot.
I can with the mouse but not via a macro …
It looks like doing that I can zoom:
tcal->Draw("avg_pc_data:threshold", "", "*");
That is too large scale. Try
It should remain zoomed to about 1 as in your plot, although should zoom more.
Any chance of confirming this bug?
The zoom in bin based. Make a histogram with more bins.