Plot 3 variables from TTree

_ROOT Version:6.12/06
_Platform: ubuntu 18.04
_Compiler: gcc version 7.3.0

Dear rooters,

I am trying to correlate 3 variables (x, y, z) that are stored as TBranches in a TTree (t) by plotting them in a 2D plot using the following command

t->Draw("x:y:z", " ", "colz")

What I get looks like that

Then if I do the same but I define a binning using
t->Draw("x:y:z>>h(xbins, x1, x2, ybins, y1, y2, zbins, z1, z2)", "", "colz")
and I get the following plot which looks exactly the same as the previous one and it remains unchanged regardless of the binning I choose.

So this keeps me puzzled and question arise :

  1. What is the z value in the (x,y) combination? I believe that it’s the maximum z-value, but I would like to confirm it.

  2. How can I change the binning in this plot?

Thanks in advance


@Wile_E_Coyote are you hinting at the line in the doc that says that e1:e2:e3 is an unbinned 3D scatter plot?

See all occurrences of “e1:e2:e3”.

I’ll take it as a yes…?

When I say all, I really mean all.

Thank you a lot!!!

I believe what Wile_E is hinting at is the drawing option "colz" which triggers a scatter plot.

But as I see it you don’t have another option to draw it except “colz” though. Or am I wrong?

The COLZ option used with TTree::Draw on 3 variables maps two variables on the x, y position and the 3rd one on the color map. That’s the plot you got. You can use other options like BOX, BOX1. They will fill an histogram and plot it with this option. You can also draw Parallel coordinates but I am not sure that makes real sense with 3 variables (to be tried). Do you have some other representations in mind ?

THistPainter -> Options supported for 3D histograms

And some examples here:

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