Slice draw of a TH2 with THStack?

Dear,

I want to do a slice draw of TH2F. The pattern of the slice draw is like the following picture. Is there a way to do this?

20170826233835

My TH2F is like this:

Thank you.
Han

Hi Han,

you can always fill a stack with slices of an histos of dimension higher than 1: https://root.cern.ch/doc/master/classTHStack.html#a0cdb877bb90549f84c751bd07493d4df

Cheers,
d

Dear dpiparo,
Thank you very much.
The THStack->Draw() method gives a graph in which that these TH1s covers each other one by one on the same plane. The graph pattern is not exactly what I want (certainly, the TH1s form the THStack() method is the one what I want).
What I want is the pattern in the fist attached picture in this post. The pattern, to some degree, seems like a ‘3D’ painting. In this pattern, the Y axis values corresponds to the bin center of the projected dimension.

Is there some other advice.

Thank you.
Han

Maybe something like this?

Dear ksmith,
Thank you very much.
It seems that your advice is right. However, it is a pity that I using V5.34 with Win7. I will manage to try the violin draw with higher ROOT version.
Anyhow, Thank you for your time!

Sincerely,
Han

Hi,
Unfortunately, the colorful slices will not be possible at the moment. But it looks interesting. Still thinking to put that on my list

In case you can live with the fact that the slices are one color only, I think violin is what you need.
in default case the slices will not overlap, use SetBarWidth(…) with an argument greater than 1 in order to do so.

As you are using Windows root6 or higher will not be available for you. violin charts in the way they are shown above are only available for root 6.someting. So you really need root6. I haven’t tried myself, but as far as I know root6 is running on docker now, that means should be running on windows, too, please correct me if I am wrong

Don’t hesitate to contact me if there are any questions regarding candle- or violin charts.

Cu
Georg

Information on running ROOT 6 on windows (the second option requires Win 10):


Dear Georg_T, Dear ksmith,
Thank you very much!

Sincerely,
Han

Looking at your plot I see it is indeed a 4 dimension plot. Each plot has 2 axis (x and y), you then have a 3rd axis (the depth of your plots) and finally the colour which seems to be mapped on yet a other variable. There is no direct mapping of a such 4D object in ROOT. And certainly starting from a TH2F will not allow to define the colouring rule. The plot itself is not very difficult to produce as this is 2d graphs plotted on top of each other. Drawing them in the right order (black to front will be enough) . What is needed is the rule to define the graphs colors.

Dear couet,
Sorry for my late reply. Thank you for your time.
I do not understand how to plot this kind of graph with TGraph2D.
Further more, I would like to explain the graph:

Pic-1
20170826233835

The pattern of this plot seems like a ‘domino’ as shown in the following picture.

Pic-2:

Each card of the domino is a ‘TH1’, and this ‘TH1’ is just a projection of a part of the ‘TH2’ (as shown in the next picture, the slice that enclosed with two red lines, and projected to the PSD axis).

Pic-3

The slices in Pic-3 makes ‘TH1s’, each ‘TH1’ is a ‘card’ as shown in the Pic-2, the ‘domino’. The colors of the ‘TH1s’ is only used to distinguish them form each other. The height of the ‘TH1s’ is represented by the height of each ‘card’ as in the ‘domino’ draw. The ‘QI’ values (x in Pic-3) of the slices makes the Y-position in Pic-1.

Thank you.
Han

Ok I understand. There is no simple way in ROOT to draw a collection of TH1 with this pseudo 3D effect .

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