Number of divisions on palette

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 :slight_smile: Any clue?

May be this page will help you:
root.cern.ch/drupal/content/how- … or-palette

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.).

Oh sorry…

h2->GetZaxis()->SetNdivisions(...);
1 Like

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.

Dear rooters,

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

doesn’t work for my little test macro:

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

Warnings concerning a “logarithmic palette”:


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

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?