Drawing two histograms on top of each other

Hi,

I am drawing two histograms but at the point where they meet it looks messy, and either side. Not sure how to resolve this.

At the draw part I do this:

        TCanvas *d = new TCanvas ("lifetime", "lifetime", 600, 600);
        h5->Draw("H");
        h5->SetLineColor(kRed);
        h6->Draw("H same ");
        h6->SetLineColor(kGreen);

I want the red to stop at x = 0.860 and the green to start at x=0.860
Lifetime_ToyModel.pdf (17.8 KB)

Hello @amytee,

I am quite sure there should already be topics on the forum about this. Try keywords ‘overlap’ and ‘histogram’.

However, I am adding @moneta to this thread. Maybe he knows the answer if you don’t find it.

Cheers,
J.

Hi,

I have not found anything useful.

Amy

What do you mean by “messy” ? it looks fine seems to me.

Hi,

I am trying to avoid having the red and green lines overlapping. I want the red to stop at x=0.860 and the green to start at that same point.

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

We will need a reproducer macro to see how that can be done.