TH2D box same

Dear ROOT experts,

I am using root version5.18 and have a problem when trying to draw two 2d histograms using the box option in the same canvas.

If I do:
hist1->Draw(“box”)
hist2->Draw(“samebox”) (or (“same,box”))

the box option turns off.

Is there any good reason for this?

Maiken

You must use the option “sames”, not same, ie

hist1->Draw("box") hist2->Draw("sames box")

see documentation of the section “Statistic Display” in THistPainter::Paint

Rene

Well, as far as I have understood, I do not need the statistic display. I only need to draw two 2D histograms in the same canvas both with the box option. If I draw 1 2D histogram it works fine, but plotting the second histogram, I get a scatter plot with no option box which leads to the whole pad being filled with points.

Maiken

Sorry, I confused the stats box with the option box. Could you send the shortest possible RUNNING script reproducing your problem?

Rene

Hi,

I have tried to make a reduced version of the macro, and realize that the problem is not that the box option goes off, but another, puzzling thing:

If I just draw a 2D histogram by clicking on it in a TBrowser, not choosing any draw option, the whole canvas is filled with histogrampoints. If I then, draw it again, choosing the box-option, just a small area has boxes, see attached plots.

I have seen this before without understanding why. An explanation, and solution would highly be appreciated! I don’t expect to have points everywhere in the canvas, the box-option figure looks more like what I would expect.

Thanks,
Maiken


c1.C (23.6 KB)


box.C (23.6 KB)