Cont4 introduces strange drawing

Hi all,

I want to draw a 1D histogram on the top of a 2D histogram. The script attached is doing exactly what I want to do. The only problem is that I don’t like the artifacts which Draw(“cont”) produces, and I want to use “cont4” instead. When trying to change in the script “cont” to “cont4” I am loosing my 1D histogram (or at least most of it). Any idea why? I guess that the cont4 option is changing something in the gPad, but I do not see why “cont4” is doing that and “cont” is not?

test.C (82.8 KB)

Attached you will find a working macro. CONT4 use a special algorithm which does allow simple drawing using “SAME” on top of it. It is on our todo list to improve it.

cont4same2.C (82.9 KB)

Thanks a lot. It works. For one pad. I have actually a canvas with a few TPads on it. On two of them I tried with the help of your example to draw the output from two different histograms. What I was surprised to see was the Draw(“cont1”) from the second histogram on the top of my first histogram. To visualize what I mean I changed a little bit yous script. It is visible on pad6_4 that the cont1 version of the histogram was once more drawn on top of the 1D histogram. How can I avoid that?

Thanks in advance,
cont4same2.C (83.7 KB)

I will look. Note that you can also use option COL instead of cont4 and you do not need the trick I sent you in that case.

Attached is the corrected macro. Note that I used DrawClone instead of Draw because you are using always to two same histograms. If you have different histogram you can use Draw().
cont4same2.C (83.7 KB)

Thanks! Finally, the script does what I wanted it to do.