TGraphErrors discontinuous axis?


I do have a TGraphErrors object where the x-axis values are clearly separated in two bunches (see attached 2nd figure). I was wondering how best I could achieve to represent this by squeezing the void part in the middle of the two points’ sets (something formally equivalent to the drawing in first attachement).
I first tried to get this by plotting 2 frame histograms in a divided canvas and playing with margins, but a) I never got the axis border right (boundary labels were half missing) b) it would of course not let me zoom the y-axis consistently for the whole data set.
I then tried to play with TAxis::SetBinLabel but the ticks of the axis then disappeared…

Any hints ?


ROOT v4.01/02 on SL302.

The discontinuous axis you are describing here are not implemented. But I am surprised you could not achieve something similar using two pads next to each others. Do you have an example showing the difficulties you encountered with this approach ?


Well, I’ve not experimented a lot with it, as it’s not exactly what I’d like to have (as I said, even if it worked, it would not let me e.g. zoom the y-axis for the whole x range easily), but here’s a sample of the problem (the right y-axis of the left panel is not visible, and the right-end of the left panel’s x-axis label is clipped).

void test() { gROOT->SetStyle("Plain"); gStyle->SetOptStat(0); TGaxis::SetMaxDigits(7); // TFile* f = new TFile("gainEvolution.run4_and_5.root"); TH2* h1 = new TH2F("h1","h1",100,105000,125000,10,100,150); TH2* h2 = new TH2F("h2","h2",100,145000,165000,10,100,150); TCanvas* c = new TCanvas("c","c"); c->Divide(2,1); c->cd(1); gPad->SetRightMargin(0.00001); gPad->SetGridx(); h1->Draw(); h1->SetNdivisions(505); //gE3_5_x_3_9_15_0_abs->Draw("LP"); c->cd(2); gPad->SetLeftMargin(0.00001); gPad->SetGridx(); h2->Draw(); h2->SetNdivisions(505); // gE3_5_x_3_9_15_0_abs->Draw("LP"); }