I’ve got some code producing graphs and putting them into a multigraph. In principle it works well, but I have some problems with setting the range of the x-axis.
I’ve attached the C-macro saved from the canvas, one gif-file with the un-zoomed output and one with my try to set the range of the x-axis from 0 to 20. I tried changing the ranges by hand on the canvas and with SetUserRange.
As you can see, the lower bound is around -50 instead of 0 and the higher bound is around 50 as well.
What do I have to do to change the ranges to for example 0 - 20?
In the example you posted it works as I would expect. But what’s the reason it doesn’t work in my real-life application?
I added the line
multigraph->GetXaxis()->SetRange(5,6);
to the C-macro i’ve attached before and still don’t get any closer to the zoom-level I want (see attachment).
It seems to me, that I have to increase the number of bins somehow… but I’m drawing graphs, not histograms, so why do I have to care about bins anyway?
Hi,
I was also trying to plot a graph and modify the range of the axes. I tried with ‘->SetLimits(#,#)’, ‘->SetRange(#,#)’ as well as ‘->SetRangeUser(#,#)’. Nothing worked. I also referred to the pages Page1 and Page2. I have also tried as is advised here. But with no effect. My code is attached below. Any help will be appreciated. MyGraph.C (1.6 KB)
Sorry Olivier, actually I was looking for solution and found this post to be on the same issue. Thought it’s better that I don’t open another post. Sorry!
Thanks a lot Wile (or, whatever-the-real-name-is ) . It’s working fine. But I was wondering why the command multigraph->GetXaxis()->SetLimits(240., 3210.); is not working. Can you explain a bit, please?
Anyway, thank you again.