# Struggling to change to a log axis

**URL:** <https://root-forum.cern.ch/t/struggling-to-change-to-a-log-axis/32498>\
**Category:** Newbie\
**Created:** [January 30, 2019, 10:00am UTC](https://root-forum.cern.ch/t/struggling-to-change-to-a-log-axis/32498 "2019-01-30T10:00:48Z")\
**Posts on this page:** 4\
**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, 10:00am UTC](https://root-forum.cern.ch/t/struggling-to-change-to-a-log-axis/32498/1 "2019-01-30T10:00:49Z")

</div>

Hi,  
I’m currently working on reproducing a graph (using TProfile) that displays the x-axis logarithmically as shown in the first attachment.

![correct%20](https://root-forum.cern.ch/uploads/default/original/3X/7/3/73b8c80626518d564eb68f7164871436ce11da4f.png)

 ![wrong%20](https://root-forum.cern.ch/uploads/default/original/3X/9/6/96e8a759f5097a6fa80051842ccaf5d2347dccc4.png)

which is labelled ‘correct’. However, when I use “canvas-\>SetLogx()”, the X-axis becomes logged but not in the way I would like.

I’ve been recommend to try to bin my data logarithmically but I’m not sure where to start with doing this. Is there an easier way of manipulating the x-axis to achieve this.

Thanks for any help 🙂

---

<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:** [January 30, 2019, 10:05am UTC](https://root-forum.cern.ch/t/struggling-to-change-to-a-log-axis/32498/2 "2019-01-30T10:05:32Z")

</div>

Is the minimum x value equal to zero or negative ?

---

<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, 10:12am UTC](https://root-forum.cern.ch/t/struggling-to-change-to-a-log-axis/32498/3 "2019-01-30T10:12:34Z")

</div>

I’ve defined as starting from zero using:  
TProfile\* prof = new TProfile(“prof”, “prof”, 14, 0, 140 );

EDIT:  
I’ve just changed in to a negative value and I observe the scale I want - Thanks for the quick help. Although if you can explain why this fixes it, that would be helpful.

---

<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:** [January 30, 2019, 10:16am UTC](https://root-forum.cern.ch/t/struggling-to-change-to-a-log-axis/32498/4 "2019-01-30T10:16:54Z")

</div>

I would rather do:

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

```

to be conform to your model plot
