# Titles of x,y axis

**URL:** <https://root-forum.cern.ch/t/titles-of-x-y-axis/27724>\
**Category:** ROOT\
**Created:** [January 27, 2018, 5:45pm UTC](https://root-forum.cern.ch/t/titles-of-x-y-axis/27724 "2018-01-27T17:45:57Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![sohail](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/6de8d8/32.png) [@sohail](https://root-forum.cern.ch/u/sohail)\
**Post date:** [January 27, 2018, 5:45pm UTC](https://root-forum.cern.ch/t/titles-of-x-y-axis/27724/1 "2018-01-27T17:45:57Z")

</div>

my code is not giving titles of axis i gave command but it not working then i used off set value but no effect x axis shows far away from borderline of axis after applying offaxis values. what should i do?

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [January 27, 2018, 8:50pm UTC](https://root-forum.cern.ch/t/titles-of-x-y-axis/27724/2 "2018-01-27T20:50:39Z")

</div>

Hi,  
can you post the minimal amount of code which reproduces your issue?

D

---

<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 28, 2018, 7:20pm UTC](https://root-forum.cern.ch/t/titles-of-x-y-axis/27724/4 "2018-01-28T19:20:22Z")

</div>

I do not know what the original author of this thread means but it reminded me about a bug that I met in ROOT 6.10/08 and 6.12/04 (I think older versions were fine).  
The following macro draws the graph but the axes titles are not present (uncomment the one line below in order to get them):

```auto
{
  TGraph *g = new TGraph(2);
  g->SetMinimum(0.1); g->SetMaximum(10);
  g->SetNameTitle("g", "graph title;x axis title;y axis title");
  g->SetPoint(0, 1, 1); g->SetPoint(1, 2, 2);
  // g->SetTitle(g->GetTitle()); // bug fix: restore axes titles
  g->Draw("ALP");
}

```

---

<div class="post-metadata">

**Author:** ![amadio](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/amadio/32/12562_2.png) [@amadio](https://root-forum.cern.ch/u/amadio)\
**Post date:** [January 29, 2018, 9:28am UTC](https://root-forum.cern.ch/t/titles-of-x-y-axis/27724/5 "2018-01-29T09:28:12Z")

</div>

Thank you for reporting. This is now [ROOT-9222](https://sft.its.cern.ch/jira/browse/ROOT-9222).

---

<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 29, 2018, 9:30am UTC](https://root-forum.cern.ch/t/titles-of-x-y-axis/27724/6 "2018-01-29T09:30:59Z")

</div>

This way of setting titles for graphs is not implemented. It should

---

<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 29, 2018, 9:54am UTC](https://root-forum.cern.ch/t/titles-of-x-y-axis/27724/7 "2018-01-29T09:54:57Z")

</div>

Actually, this way of setting axes titles for graphs works fine in ROOT 5.34/36, “v5-34-00-patches” and 6.08/06.

Also, it one comments out the line which sets the “min” and “max”, or moves it further down in the code, it will magically start to work in newer ROOT versions.

---

<div class="post-metadata">

**Author:** ![sohail](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/6de8d8/32.png) [@sohail](https://root-forum.cern.ch/u/sohail)\
**Post date:** [January 29, 2018, 1:04pm UTC](https://root-forum.cern.ch/t/titles-of-x-y-axis/27724/8 "2018-01-29T13:04:11Z")

</div>

i am using root version of 5.34 but its not picking up titles.

---

<div class="post-metadata">

**Author:** ![sohail](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/6de8d8/32.png) [@sohail](https://root-forum.cern.ch/u/sohail)\
**Post date:** [January 29, 2018, 1:35pm UTC](https://root-forum.cern.ch/t/titles-of-x-y-axis/27724/9 "2018-01-29T13:35:38Z")

</div>

oohh no its picking up titles but far away from axis margin line???  
thanks in advance

---

<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 29, 2018, 1:47pm UTC](https://root-forum.cern.ch/t/titles-of-x-y-axis/27724/10 "2018-01-29T13:47:35Z")

</div>

Try to remove “${HOME}/.rootrc” and/or “./.rootrc” (if they exist) and then start ROOT using `root -n` (if it then works, check any existing “.rootrc” and/or “rootlogon.C” files).

---

<div class="post-metadata">

**Author:** ![sohail](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/6de8d8/32.png) [@sohail](https://root-forum.cern.ch/u/sohail)\
**Post date:** [January 29, 2018, 1:56pm UTC](https://root-forum.cern.ch/t/titles-of-x-y-axis/27724/11 "2018-01-29T13:56:58Z")

</div>

![image](https://root-forum.cern.ch/uploads/default/original/2X/9/9b40ccba17e85f4889b3da2400636b8bd1396718.png)  
these lines are not there.

---

<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 29, 2018, 1:58pm UTC](https://root-forum.cern.ch/t/titles-of-x-y-axis/27724/12 "2018-01-29T13:58:57Z")

</div>

It’s clear that your macro defines the sizes and offsets of the axes titles. You either need to remove these calls or tune them manually to what you want.

---

<div class="post-metadata">

**Author:** ![sohail](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/6de8d8/32.png) [@sohail](https://root-forum.cern.ch/u/sohail)\
**Post date:** [January 29, 2018, 2:02pm UTC](https://root-forum.cern.ch/t/titles-of-x-y-axis/27724/13 "2018-01-29T14:02:47Z")

</div>

yes here is a size 1.2 then titles was far away as x axis u can see in plot but then i put it o.6 for x and y axis then it give me plot with titles like this.

---

<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, 2018, 10:34am UTC](https://root-forum.cern.ch/t/titles-of-x-y-axis/27724/14 "2018-01-30T10:34:22Z")

</div>

> [@Publication-quality ROOT Graphics Style from ATLAS](https://root-forum.cern.ch/t/publication-quality-root-graphics-style-from-atlas/27751):
>
> Thanks to ATLAS, and upon popular request: here is a set of example macros showcasing how to configure publication quality graphics! And example picture is here: [atlasrootstyle-pub.tar.bz2](https://root-forum.cern.ch/uploads/default/original/2X/9/9a77b76a6dc3b0b93a15a9a56d2782723a5d6610.bz2) (1.3 MB)

---

<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:** [February 2, 2018, 4:21pm UTC](https://root-forum.cern.ch/t/titles-of-x-y-axis/27724/15 "2018-02-02T16:21:49Z")

</div>

Now fixed. Thanks.  
SetNameTitle was now changing the underlaying histogram name and title.  
SetTitle was. The macro was working using SetTitle.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [February 16, 2018, 4:21pm UTC](https://root-forum.cern.ch/t/titles-of-x-y-axis/27724/16 "2018-02-16T16:21:50Z")

</div>

Closed on February 16, 2018, 4:21pm UTC

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