Problem with SetRangeUser in TGraphErrors drawing

Dear Root experts,
I’m observing a graphic problem while trying to plot a TGraphErrors with error bands (I’m using root_v6.11.02)
My plot looks fine if I don’t touch the axis ranges, but when I try to change them I end up with this:

(unfortunately the forum doesn’t let me upload two pictures)

I use the following code for changin the axis:>GetXaxis()->SetRangeUser(600, 1800);>GetYaxis()->SetRangeUser(0, 80);

(but the same behaviour happens if I do it by hand with the mouse from the canvas)

and these line for the drawing:>Draw("a4");>Draw("same c X");

I think it is an extrapolation problem, since everything work fine if I use:>Draw("a3");

Do you have any suggestion on how to fix this?
I also attach a root file with the raw TGraph, maybe it could help
laserprofile.root (12.8 KB)

Many thanks for your help,

you should load them one by one.

I am looking at you problem now. I might well be that in that case the clipping of the polygon is wrong.

Yes you should use A3 as explained here.

I made the following macro:

void cmerlass() {
   auto f = new TFile("laserprofile.root");
   auto *g = (TGraphErrors*)f->Get("Graph");
   g->GetXaxis()->SetRangeUser(600, 1800);
   g->GetYaxis()->SetRangeUser(0, 60);
   g->Draw("c X");

I get this picture:

and by the way I get the same picture with A4

In the end I found a range that is good for my plot and for which the figure doesn’t break even with a4. I just wanted to report that it may be a bit unstable, I agree that “a3” is a safer option.


Well, the ranges you sent me work both with A3 and A4… may be you have an old ROOT version in which there was a problem. I am using the master and it is fine.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.