Problem with THStack::Draw("lego nostack") for TH2

Thanks Timur. [quote]In principle, we can change THStack::Paint…[/quote]Could you please give it a try?

If you don’t have much time, could you please provide your ad-hoc solution in the meanwhile (as you did for the voxel request, /viewtopic.php?f=3&t=5648&start=33) ?
Also, is it possible to change the transparency of each TH2 independently?

TIA,
Z

Providing ad hoc solutions is not easy unless you are willing to give it a try and install it yourself for yourself. Then you cannot complain about bugs etc … Timur can send it to you “as it is” and you play with … We do not have enough time to spend on “bricolages”…

Thanks Olivier.
I’m ok to wait (without complaining) for a proper change of THStack::Paint() if you and Timur think this could be achieved within a few weeks.
Otherwise, I’ll be grateful if you send me what Timur did “as it is”. I’ll try to manage it on my own.
TIA guys,
Z

I am not sure this can be achieved by Timur within a few weeks because he has some urgent topics to deal with, and, as he told you, that’s a tricky thing which would require deep changes.
So the best solution is that Timur send you what he has, and you try it “as it is”. Note that if, from the code Timur will send you, you are able to develop yourself something which could be included inside the official ROOT version, we will consider it and take it if it is good.

I think that there is a trivial solution to this problem. I may post a solution once I have an acceptable network connection or back to CERN next week

Rene

OK :slight_smile:

Thanks René !
Fingers crossed :wink:
Z

[quote=“Zesp”]Thanks Timur. [quote]In principle, we can change THStack::Paint…[/quote]Could you please give it a try?

If you don’t have much time, could you please provide your ad-hoc solution in the meanwhile

TIA,
Z[/quote]

Ok, I’ve tried several options. Transparency is bad idea, as I expected, non-transparent are nice (please note, not to hide the smaller bar, I always draw the bigger as the “remaining part” on top of smaller. I mean, if
I have, say, bin contents 0.2 and 0.5, I’ll draw bar with the height 0.2 (color 1) and bar from 0.2 to 0.5 with color 2.
But since my solution is not trivial, let’s wait for Rene’s trivial one.








Timur,

That’s not what Zesp wants. What you show is already available in the normal pad. See for example $ROOTSYS/tutorials/hist/hstack.C. We are talking about the “nostack” option

Rene

Playing with the bar offset and the bar width may help a bit but still it is not satisfactory because when you draw a lego plot with the option SAME the previous lego is not taken into account by the hidden faces removal algorithm (see the image). The only clean way to implement it would be to have the option NOSTACK for THStack drawn as lego.

{
   gStyle->SetHistTopMargin(0);

   TH2F *h2a = new TH2F("h2","h2",3,-3,3,3,-3,3);
   TH2F *h2b = new TH2F("h2","h2",3,-3,3,3,-3,3);

   h2b->SetFillColor(kYellow);
   h2b->FillRandom("gaus",40);  
   h2a->SetFillColor(kRed);
   h2a->FillRandom("gaus",40);
   h2a->Draw("lego1");
   h2a->SetBarWidth(0.1);
   h2b->Draw("lego1samebb");

   h2a->SetBarWidth(0.05);

   h2b->SetBarWidth(0.05);
   h2b->SetBarOffset(0.5);
   h2a->SetMaximum(25.);
   h2b->SetMaximum(25.);
}


OK Olivier. Basically you posted my solution in playing with the bar offset and width.

Rene

Ok, I’ll check in THStack how difficult it is to implement properly. I’ll put it on the to-do list if that’s not trivial.

Thanks guys :slight_smile:
Looking forward to reading you.
Z

[quote=“brun”]Timur,

That’s not what Zesp wants. What you show is already available in the normal pad. See for example $ROOTSYS/tutorials/hist/hstack.C. We are talking about the “nostack” option

Rene[/quote]

Hi Rene!

Right :slight_smile: Olivier explained me several times what is stack/nostack and I still understand it wrong :slight_smile:
But if I can do stack, I can do nostack :slight_smile: It’s even simpler :slight_smile:








Dear rooters

Sorry for waking up this thread, but I wonder if this problem has been solved meanwhile. At least in my version 5.28/00b the nostack option does not work with lego or surf.

Is there any workaround for showing intersecting (TH2) surfaces?

Cheers,
Andreas

Nothing new on this. See:
root.cern.ch/root/html/THistPainter.html#HP26