TGraphErrors, TH1F, TAxis: SetRangeUser

I have to following problems with SetRangeUser (TGraphErrors/TH1F):

(i) It seems not possible to zoom the x-axis to ranges larger than the actual data set. Sometimes this would be very useful.

(ii) If I superimpose multiple plots (TGraphErrors/TH1F) with different x-axis ranges, the first data set is setting the maximum limits for the x-axis range, which is very ugly. It seems to follow point (i). This means if plotting multiple data set, the one with the largest x-range needs to be plotted first. If the data sets are partially shifted this is not always possible, or one data set needs to be artificially extended (which is ugly).

It would be nice that the SetRangeUser for the x-axis is as flexible as for the y-axis (where no such restriction is present), i.e. I can chose just an arbitrary x-range which might be larger than any of the plotted data sets.

In case this is already possible but I am missing something, please let me know, otherwise please consider to remove the rigid x-range user range handling.

Do you have a small macro showing the problems you encounter ? I will try to modify it to make it work properly.

Well, here is a little example:

// rangeProblem.C
  TCanvas *c1 = new TCanvas("c1", "my canvas ..");

  double x1[]  = {0.0, 0.1, 0.2, 0.3};
  double y1[]  = {0.0, 0.1, 0.2, 0.3};
  double ey1[] = {0.02, 0.02, 0.02, 0.02};

  double x2[] = {0.2, 0.3, 0.4, 0.5};
  double y2[] = {0.3, 0.2, 0.1, 0.0};
  double ey2[] = {0.02, 0.02, 0.02, 0.02};

  TGraphErrors *g1 = new TGraphErrors(4, x1, y1, 0, ey1);
  TGraphErrors *g2 = new TGraphErrors(4, x2, y2, 0, ey2);


  g1->GetXaxis()->SetRangeUser(-0.1, 0.6); // <<== DOESN'T WORK
  //g1->GetXaxis()->SetRangeUser(0.1, 0.2); // <<== DOES WORK


I would like to plot g1 and g2 on the same graphical output, but the x-axis range is limited to the g1 range :cry:

Use a TMultiGraph. see examples in $ROOTSYS/tutorials/graphs/multigraph.C


Thanks, solves already quite a few problems