Stagger points (for visibility) in 1D histogram

I’m plotting three histograms, with the same binning, in the same plot, with error bars. Because I don’t want the the points and error bars to overlap, I want to stagger them slightly in X. Does anyone know of some clever idea for this?

The class doing that is:
root.cern.ch/root/html/TGraphBentErrors.html

Try this “brutal fix” (see also [url=https://root-forum.cern.ch/t/can-we-shift-histogram-for-several-channels/12050/1 old thread[/url]): [code]{
TCanvas *c1 = new TCanvas(“c1”, “c1”, 600, 400);

// create and fill three histograms
TH1F *h1 = new TH1F(“h1”, “h1”, 10, -3, 3);
h1->SetMarkerStyle(21);
h1->SetMarkerColor(1);
TH1F *h2 = new TH1F(“h2”, “h2”, 10, -3, 3);
h2->SetMarkerStyle(22);
h2->SetMarkerColor(2);
TH1F *h3 = new TH1F(“h3”, “h3”, 10, -3, 3);
h3->SetMarkerStyle(23);
h3->SetMarkerColor(3);
for (Int_t i = 0; i < 1000; i++) {
h1->Fill(gRandom->Gaus(0, 1));
h2->Fill(gRandom->Gaus(0, 1));
h3->Fill(gRandom->Gaus(0, 1));
}

// calculate the "x axis split"
TAxis *a = h1->GetXaxis();
Double_t dx = a->GetBinWidth(1) / 5.;
// shift “h2” to the left (works only for a “fixed bin size” histogram)
a = h2->GetXaxis();
a->Set(a->GetNbins(), a->GetXmin() - dx, a->GetXmax() - dx);
// shift “h3” to the right (works only for a “fixed bin size” histogram)
a = h3->GetXaxis();
a->Set(a->GetNbins(), a->GetXmin() + dx, a->GetXmax() + dx);

// draw all histograms
gStyle->SetEndErrorSize(1);
gStyle->SetErrorX(0.);

THStack *s = new THStack(“s”, “My Histograms;My X Axis;My Y Axis”);
s->Add(h1);
s->Add(h2);
s->Add(h3);
s->Draw(“E1 NOSTACK”);

return c1;
}[/code]

Ah this is exactly the thing, thank you. (The TGraphBentErrors only displaces the error bars, right?, and not the points which is what I needed.)

Yes