Non continuous / broken Xaxis

Hi,

Is there a way to draw a non-continuos x axis in TGraph?

For example I have
Double_t x1[5] = {1.,2.,3.,4.,5.}
Double_t x2[5] = {48.,49.,50.,51.,52}
Double_t y1[5] = {18.,9.,20.,21.,12}
TGraph *g1 = new TGraph(5,x1,y1);
TGraph g2 = new TGraph(5,x2,y1);
TMultiGraph mg = new TMultiGraph();
")
")
mg->Draw(“a”)

Now I would like the x axis to go from 1 to 5, then have the next number as 48, since there’s nothing between 5 and 48.

Is this possible?

• Sujeewa
``````{
TCanvas *c = new TCanvas("c", "c",700,900);

p1->SetBottomMargin(0.);
p1->SetFillColor(0);
p1->SetBorderMode(0);
p1->Draw();

p2->SetTopMargin(0.);
p2->SetFillColor(0);
p2->SetBorderMode(0);
p2->Draw();

float x1[] = {3,5,6,9}; float y1[] = {100,900,400,200};
TGraph *gr1 = new TGraph(4,x1,y1);
gr1->GetXaxis()->SetLimits(0.,10.);
gr1->SetTitle("");
gr1->GetXaxis()->SetLabelSize(0);
gr1->GetXaxis()->SetTickLength(0);
gr1->SetMarkerStyle(20);

float x2[] = {1,2,3,8}; float y2[] = {4,7,6,5};
TGraph *gr2 = new TGraph(4,x2,y2);
gr2->GetXaxis()->SetLimits(0.,10.);
gr2->SetTitle("");
gr2->SetMarkerStyle(22);

p1->cd();
gr1->Draw("ALP");
gr1->GetHistogram()->SetMinimum(-20.);

p2->cd();
gr2->Draw("ALP");
gr2->GetHistogram()->SetMaximum(7.5);

c->cd();