Color Palette

I’ve been trying to readjust the palette axis for obvious reasons (see attached). How can I set it up to only include the lower “100” levels and leave off the other “900”? Thanks.

Do:

h->SetMinimum(0);
h->SetMaximum(100);

Rene

Hi Rene,
in root.cern.ch/root/htmldoc/src/TH … olorLevels

we have
// Initialize the colour levels
if (ndivz >= 100) {
Warning(“PaintSurface”, “too many color levels, %d, reset to 8”, ndivz);
ndivz = 8;
}

Is it really necessary to limit a number of levels?

Regards. Valeriy

Valeriy,

This was not teh question.

Rene

Hello
I have a TH2F *h drawn with a colour palette in a COLZ mode.
In addition to the colour labels, I am interested to add a title to the colour palette, describing the physical units of the colour labels.

I am using the following code:

TPaletteAxis *pal = (TPaletteAxis*)h->GetListOfFunctions()->FindObject("palette"); pal->GetAxis()->SetTitle("RMS [ADC]");

However, I get the following error:

[quote] *** Break *** segmentation violation
Attaching to program: /proc/27394/exe, process 27394
[Thread debugging using libthread_db enabled]

warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7fff189fd000
0x0000003058099df5 in waitpid () from /lib64/libc.so.6
#1 0x000000305803c7a1 in do_system () from /lib64/libc.so.6
#2 0x00002b02a8df045c in TUnixSystem::StackTrace() ()
from /usr/local/lib/root/libCore.so
#3 0x00002b02a8def603 in TUnixSystem::DispatchSignals(ESignals) ()
from /usr/local/lib/root/libCore.so
#4
#5 0x00000000004056fe in main ()
A debugging session is active.

    Inferior 1 [process 27394] will be detached.

Quit anyway? (y or n) [answered Y; input not from terminal]
Detaching from program: /proc/27394/exe, process 27394[/quote]

What is wrong and is there a way to introduce a title to the colour palette?
Viesturs

You should do a canvas update/modified after drawing the histogram…

Set the Z axis tile.

Hello, I modified my code as suggested by markusries:

TCanvas *c = new TCanvas(); h->Draw("COLZ"); c->Modified(); c->Update(); TPaletteAxis *pal = (TPaletteAxis*)h->GetListOfFunctions()->FindObject("palette"); pal->GetAxis()->SetTitle("RMS [ADC]");

This way I managed to avoid the program crash, but the title of the colour palette did not appear, contrary to what I intended.

Setting the Z axis title was tried out before, but was not fruitful.

Regards,
Viesturs

   TH2D *h = new TH2D();;
   h->SetBins(10,0,10,10,0,10);
   h->Fill(1,1,1);
   h->Fill(3,3,3);
   h->Fill(5,5,5);
   h->Draw("COLZ");
   h->SetXTitle("aaaaa");
   h->SetYTitle("bbbbb");
   h->SetZTitle("ccccc");

Hello, couet
I tried out your code. The histogram drew nicely, but the title of colour palette (title of Z axis) did not appear. If it appeared with you, then we must have different versions of Root.

Thanks,
Viesturs

move the palette