Color Pallete on a 4D plot

Hi All,

Apologies if this is a duplication of a previous question. Can anyone tell me if I can display the color pallete when plotting a 4D plot using TTree::Draw ? If so how?

Cheers,

Ben

There is no way right now. I will look at that.

Hi,

On a similar note is there a way to log scale the 4th axis as well? In 2+1D plots this is done by log scalling the Z-axis.

Cheers,

Ben

Now, in the SVN trunk, the option COLZ used in TTree::Draw paint also the color palette.

Regarding your question about log scales:

The SetLog…() option act on on the X Y and Z axis. There is no SetLogT() …

you can do: ntuple->Draw(“x:y:z:log10(t)”,"",“colz”)

making sure t > 0

Thank you for your reply. I come accross a small problem using the colz option with the 4D plots. The colour axis takes the same title as the Z-axis. Is there some way to stop this happening or even lable the colour axis separately?

Cheers,

Ben

the color axis has no title by default if you do:

ntuple->Draw(“px:py:pz:px”,"",“colz”)

how can you tell that it has the same title as the Z axis ?

Hi,

I have the same problem here. If I do ntuple->Draw(“px:py:pz:px”,"",“colz”), as you say, the same title name as the z axis appears on the palette. How can I change it ?

Furthermore, after having drawn this 4D plot, I’m trying to modify it. I want to smooth the palette and set the ranges. The palette gets modified, but not the plot… I tried the following :

UInt_t Number = 3;
Double_t Red[Number]    = { 1.00, 0.00, 0.00};
Double_t Green[Number]  = { 0, 1, 0};
Double_t Blue[Number]   = { 0.00, 0.00, 1.00};
Double_t Length[Number] = { 0.00, 0.50, 1.00 };
Int_t nb=100;
Int_t FI = TColor::CreateGradientColorTable(Number,Length,Blue,Green,Red,nb);

TH3F *hist = new TH3F("hist","hist",20,2500,6000,20,-1200,1200,20,-500,500);

ntuple->Draw("px:py:pz:px>>hist","","colz")

hist->SetMaximum(0.003);
hist->SetMinimum(-0.003);
hist->SetContour(nb);

Do you have any idea how to solve this issue ?

yes because the palette axis and the z axis are the same in your case both “px”… see your command …

Ah sorry, yes this was just to take back your small code example. Mine looks more like : ntuple->Draw(“y:x:z:Err_By”,"",“colz”)
Is there no way to change the title name of the palette ?

I see… I’ll try to find a way.

What actually bothers me most is the rest of my problem…

No way you can smooth the plot. Do a gPad->ls()
You will see that it is done using several 3D polymarkers.
Each of them having one color. That can not be changed.

Oh I see… Then I guess the range cannot be changed either… Is there another way to show a 4D plot then ?

The option PARA also show as many variables as you want.
But I am not sure you want that.

No I really have x,y,z coordinates and at each point I have a value to plot. Here’s an example of what I could do with the colz option. It’s exactly what I want, I just want to make it nicer by having symmetric ranges.
By_old_vs_new.pdf (195 KB)

According to the code it seems the number of polymarker 2D is equal to the number of colors in the palette.
So simply do:

{
const UInt_t Number = 3;
Double_t Red[Number]    = { 1.00, 0.00, 0.00};
Double_t Green[Number]  = { 0, 1, 0};
Double_t Blue[Number]   = { 0.00, 0.00, 1.00};
Double_t Length[Number] = { 0.00, 0.50, 1.00 };
Int_t nb=200;
Int_t FI = TColor::CreateGradientColorTable(Number,Length,Blue,Green,Red,nb);
cout << gStyle->GetNumberOfColors() << endl;

ntuple->Draw("px:py:pz:px","","colz");
htemp->SetContour(nb);
gPad->Update();
}

You can verify it is true by changing nb to 3…

htemp is not defined in your code. Should I get it from the Canvas with GetPrimitive ?

It is the default one … always there… just try the macro as it is.
ntuple is from $ROOTSYS/tutorials/hsimple.C

I still get the following error :
error: ‘htemp’ was not declared in this scope
htemp->SetContour(nb);