# I need to plot 2 histograms for multiplicity in a single plot. I need it in the form of a bar chart.( 1 histogram adjacent to another)

**URL:** <https://root-forum.cern.ch/t/i-need-to-plot-2-histograms-for-multiplicity-in-a-single-plot-i-need-it-in-the-form-of-a-bar-chart-1-histogram-adjacent-to-another/40575>\
**Category:** Newbie\
**Created:** [July 22, 2020, 7:10pm UTC](https://root-forum.cern.ch/t/i-need-to-plot-2-histograms-for-multiplicity-in-a-single-plot-i-need-it-in-the-form-of-a-bar-chart-1-histogram-adjacent-to-another/40575 "2020-07-22T19:10:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Liam\_hayden](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/ecccb3/32.png) [@Liam\_hayden](https://root-forum.cern.ch/u/Liam_hayden)\
**Post date:** [July 22, 2020, 7:10pm UTC](https://root-forum.cern.ch/t/i-need-to-plot-2-histograms-for-multiplicity-in-a-single-plot-i-need-it-in-the-form-of-a-bar-chart-1-histogram-adjacent-to-another/40575/1 "2020-07-22T19:10:57Z")

</div>

\_ROOT Version:\_6.20/04

So I have already consulted the page on vertical bar charts. But it’s very confusing. Say h1 and h2 are my 2 histograms. I gave my command as below, but nothing changed. The second histogram was superimposed on the first one.

```auto
     h1->Draw ("bar2");
     h2 -> Draw ("bar2, same");

```

Any help would be much appreciated.

* * *

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [July 23, 2020, 8:23am UTC](https://root-forum.cern.ch/t/i-need-to-plot-2-histograms-for-multiplicity-in-a-single-plot-i-need-it-in-the-form-of-a-bar-chart-1-histogram-adjacent-to-another/40575/3 "2020-07-23T08:23:12Z")

</div>

```auto
{
   h1 = new TH1F("h1","h1",10,-3,3);
   h1->FillRandom("gaus",10000);
   h1->SetBarWidth(0.5);
   h1->SetBarOffset(0.);
   h1->SetFillColor(kRed);
   h1->Draw("hbar2");

   h2 = new TH1F("h2","h2",10,-3,3);
   h2->FillRandom("gaus",10000);
   h2->SetBarWidth(0.5);
   h2->SetBarOffset(0.5);
   h2->SetFillColor(kBlue);
   h2->Draw("hbar2 same");

}

```

 ![Screenshot 2020-07-23 at 10.22.44](https://root-forum.cern.ch/uploads/default/original/3X/8/5/853938a7a446410084339e7ccf97938bc12a452a.jpeg)

---

<div class="post-metadata">

**Author:** ![Liam\_hayden](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/ecccb3/32.png) [@Liam\_hayden](https://root-forum.cern.ch/u/Liam_hayden)\
**Post date:** [July 25, 2020, 7:45pm UTC](https://root-forum.cern.ch/t/i-need-to-plot-2-histograms-for-multiplicity-in-a-single-plot-i-need-it-in-the-form-of-a-bar-chart-1-histogram-adjacent-to-another/40575/4 "2020-07-25T19:45:01Z")

</div>

Thank you so much.
