# Number of divisions on palette

**URL:** <https://root-forum.cern.ch/t/number-of-divisions-on-palette/12237>\
**Category:** ROOT\
**Created:** [April 10, 2011, 8:21pm UTC](https://root-forum.cern.ch/t/number-of-divisions-on-palette/12237 "2011-04-10T20:21:29Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![LeWhoo](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/e8c25b/32.png) [@LeWhoo](https://root-forum.cern.ch/u/LeWhoo)\
**Post date:** [April 10, 2011, 8:21pm UTC](https://root-forum.cern.ch/t/number-of-divisions-on-palette/12237/1 "2011-04-10T20:21:29Z")

</div>

I cannot find a way to set number of ticks on TPaletteAxis. TH2D drawn with TPaletteAxis from 0 to 1 has tick evey 0.1, while TH2D obtained vie TF2::GetHistogram() has ticks every 0.2. I have no idea why ROOT automaticaly computes those numbers of ticks differently (with the same Z range: 0,1), but I’d like to change it 🙂 Any clue?

---

<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:** [April 11, 2011, 7:07am UTC](https://root-forum.cern.ch/t/number-of-divisions-on-palette/12237/2 "2011-04-11T07:07:01Z")

</div>

May be this page will help you:  
[root.cern.ch/drupal/content/how- … or-palette](http://root.cern.ch/drupal/content/how-define-smooth-color-palette)

---

<div class="post-metadata">

**Author:** ![LeWhoo](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/e8c25b/32.png) [@LeWhoo](https://root-forum.cern.ch/u/LeWhoo)\
**Post date:** [April 11, 2011, 2:58pm UTC](https://root-forum.cern.ch/t/number-of-divisions-on-palette/12237/3 "2011-04-11T14:58:44Z")

</div>

Maybe I am mistaken, but I think it only defines the number of colours etc., not the actual ticks on the palette axis (0.1, 0.2, 0.3, etc.).

---

<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:** [April 11, 2011, 3:07pm UTC](https://root-forum.cern.ch/t/number-of-divisions-on-palette/12237/4 "2011-04-11T15:07:40Z")

</div>

Oh sorry…

```auto
h2->GetZaxis()->SetNdivisions(...);

```

---

<div class="post-metadata">

**Author:** ![LeWhoo](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/e8c25b/32.png) [@LeWhoo](https://root-forum.cern.ch/u/LeWhoo)\
**Post date:** [April 11, 2011, 3:25pm UTC](https://root-forum.cern.ch/t/number-of-divisions-on-palette/12237/5 "2011-04-11T15:25:28Z")

</div>

Thanks. I thought that the number given in this case means the number of ticks, but it doesn’t (5 in case of scale from 0 to 1 gives 3 ticks), so for values I attempted it just didn’t give any results.

---

<div class="post-metadata">

**Author:** ![amaier](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/a9a28c/32.png) [@amaier](https://root-forum.cern.ch/u/amaier)\
**Post date:** [August 16, 2016, 2:33pm UTC](https://root-forum.cern.ch/t/number-of-divisions-on-palette/12237/6 "2016-08-16T14:33:16Z")

</div>

Dear rooters,

sorry to wake this old thread up, but I have just realized that

```auto

```

doesn’t work for my little test macro:

```auto
TH2F*h=new TH2F("h","h",10,0,10,10,0,10)
h->Fill(1,3,1)
h->Fill(2,5,3)
h->Draw("colz")
gPad->SetLogz()
h->GetZaxis()->SetRangeUser(1, h->GetMaximum())
h->GetZaxis()->SetNdivisions(1)
```

The problem is that I want to restrict my z-axis range to e.g. 1-3 and therefore have the numbers displayed at each tick. Normally the SetNdivisions() command does the trick but the Z-axis seems not to accept any other value than 0 (in which case it removes all axis labels). How can I do that?

Cheers,  
Andreas

---

<div class="post-metadata">

**Author:** ![Pepe\_Le\_Pew](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pepe_le_pew/32/12365_2.png) [@Pepe\_Le\_Pew](https://root-forum.cern.ch/u/Pepe_Le_Pew)\
**Post date:** [August 16, 2016, 5:50pm UTC](https://root-forum.cern.ch/t/number-of-divisions-on-palette/12237/7 "2016-08-16T17:50:35Z")

</div>

Warnings concerning a “logarithmic palette”:

> [@TGraph2D: logarithmic z-axis](https://root-forum.cern.ch/t/tgraph2d-logarithmic-z-axis/16525/13):
>
> Both ROOT 5.34/36 and 6.06/04 behave the same way. The graph is drawn with log-z but the color is still linear-z (improperly shown in the palette’s axis as being log, too).

> [@Problem with logarithmic color axis/colz with TNtuple](https://root-forum.cern.ch/t/problem-with-logarithmic-color-axis-colz-with-tntuple/14058/4):
>
> This seems to be a bug in ROOT (the numbers on the “z” scale, i.e. on the color palette, are wrong in “Logz” mode) and it seems to be closely related to [How plot only fit result of the TGraph?](https://root-forum.cern.ch/t/how-plot-only-fit-result-of-the-tgraph/14012/15)

---

<div class="post-metadata">

**Author:** ![amaier](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/a9a28c/32.png) [@amaier](https://root-forum.cern.ch/u/amaier)\
**Post date:** [August 18, 2016, 10:47am UTC](https://root-forum.cern.ch/t/number-of-divisions-on-palette/12237/8 "2016-08-18T10:47:39Z")

</div>

Thank you, so I see that it is not advisable to use log palettes at all, since the bug in root persists.

Let’s suppose though that the bug weren’t there and the logz axis fine to use. How can I make

```auto

```

work? Or is all the logz basically not ready for usage and one should forget about that functionality completely since there might be other severe issues?
