Option "same" in TH2, or "nostack" in THStack

Dear Rooters,

I attempted to plot more TH2D histograms (histo2D_1 … histo2D_n) with LEGO1 option on the same graph, but without stacking their bin contents. In other words, I just want the largest bin content to “stick out” among them. I tried two methods,

(1) Put all TH2D* histo2D_N into a THStack* stack, and use stack->(“LEGO1 NOSTACK”)
The NOSTACK option has no effect (it keeps stacking them).

(2) I used the SAME option,
histo2D_1-> Draw(“LEGO1”) …
histo2D_n-> Draw(“SAME”)
This gives a funny result, since it actually draws the new plot on top of the previous ones, so they are seen only in the background, the 3-d-effect is ruined. Also the Z scale is individual for each plot.

Later I found someone reported a similar thing with NOSTACK option in 2D, but it was an old post.

I could think of a way to solve this by manipulating the bin contents (checking the bins one by one for all graphs, deleting the bin content in each histogram except for the largest one…), but before I do it I wanted to ask: is there anything implemented already in the latest root to do this?

(If not, and if we are allowed to vote for some new features, I think it would be really useful to have a NOSTACK+LEGO1 option in 2D for THStack :slight_smile: I understand that NOSTACK gives an ambiguous result when the COLZ option is turned on for example, but with LEGO this would be very useful in many cases)

Thanks in advance!

same_TH2.eps (310 KB)
nostack_TH2.eps (83 KB)

The NOSTAK option works only for 1D histogram stacks.
The 2D histogram stack are always stack.
In you case I would not use stack. You should make a 2D histogram where each bin
contains the maximum (for that bin) of you histograms collection.

Thanks. Yeah, actually there has to be N number of modified histograms in order to ensure the different colors;
(One needs to check all bins, choose the histogram which has the largest value there, delete the bin content in every other histograms)

But this is only good for the visual effect, it cannot be used for analysis afterwards.

To give an example: Lets’ assume you have two 2D histogram data coming from 2 equipment, measuring the same thing, but giving slightly different results. What I want to know is not the addition (STACK) of the values in each bin content, but their average, for instance. On the other hand, I would like to visualize them with different colors on the same graph. So what I would need is:

– plot the two histo on the same graph without stacking, but preserving all bin contents for analysis.
(Visually only the histo with the largest bin content is seen for each bin, but the others are there, too)

– fit something on the surface of the collection, like you would fit on a TMultigraph.

The only solution I know of doing this is:

– Make a THStack, just for the visual effect as explained above, but not use it for physics
– Fit on another (invisible) histogram, which is constructed from the average of the bin contents of all histograms.

I personally would not like to do this, I rather give up the multicolors and do the second step only, it’s too dangerous to fit on something you don’t see. In this case, however, I don’t see at all where the data is coming from. So this is not so good either.

Any suggestions?

May be you can have a look at: