# Variable bin size for logged scale

**URL:** <https://root-forum.cern.ch/t/variable-bin-size-for-logged-scale/32501>\
**Category:** Newbie\
**Created:** [January 30, 2019, 11:34am UTC](https://root-forum.cern.ch/t/variable-bin-size-for-logged-scale/32501 "2019-01-30T11:34:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maximus12108](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/e47c2d/32.png) [@Maximus12108](https://root-forum.cern.ch/u/Maximus12108)\
**Post date:** [January 30, 2019, 11:34am UTC](https://root-forum.cern.ch/t/variable-bin-size-for-logged-scale/32501/1 "2019-01-30T11:34:07Z")

</div>

Hello,  
I’m trying to reproduce some model data (blue line), but am having problems with my bin size. the majority of my data is at the farther end of the x-axis but I want to plot more data points at the lower scale.

![31](https://root-forum.cern.ch/uploads/default/original/3X/c/8/c888a23bd1f39aeb58dae96b64d3a04af94ff46b.png)

When I increase the bin size I observe these extra points in the lower x vales but get too many points at higher x-values. Is there a way of plotting using smaller bin sizes at lower at the x-axis.  
The decleration of my TProfile looks like

```auto
TProfile* prof = new TProfile(“prof”, “prof”, 14, 1., 140 );

```

I also notice that despite declaring 14 bins I only observe 9 plotted points - is there a reason for this?

Thanks for nay help,  
Alex.

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [January 30, 2019, 11:40am UTC](https://root-forum.cern.ch/t/variable-bin-size-for-logged-scale/32501/2 "2019-01-30T11:40:53Z")

</div>

[Your histogram can have “variable bin size”:](https://root.cern.ch/doc/master/classTProfile.html#a273fe62d765d1bdc5f909aaac24d98b8)

```auto
{
  Double_t x[] = {1., 2., 3., 4., 6., 8., 12., 18., 25., 35., 45., 60., 90., 140.};
  TProfile *prof = new TProfile("prof", "prof", (sizeof(x) / sizeof(Double_t) - 1), x);
}

```

---

<div class="post-metadata">

**Author:** ![Maximus12108](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/e47c2d/32.png) [@Maximus12108](https://root-forum.cern.ch/u/Maximus12108)\
**Post date:** [January 30, 2019, 11:54am UTC](https://root-forum.cern.ch/t/variable-bin-size-for-logged-scale/32501/3 "2019-01-30T11:54:36Z")

</div>

Hi Wile\_E\_Coyote,

I came across this earlier but was unsure on how I use this to set smaller bin sized at lower the lower x-range. There are multiple options for variable bin size and I’m not sure how they differ.

Thanks.

EDIT: I noticed your edit, thankyou for the clarification 🙂
