# No shadow in lego1

**URL:** <https://root-forum.cern.ch/t/no-shadow-in-lego1/16148>\
**Category:** ROOT\
**Created:** [May 26, 2013, 5:52pm UTC](https://root-forum.cern.ch/t/no-shadow-in-lego1/16148 "2013-05-26T17:52:00Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zesp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/b5ac83/32.png) [@Zesp](https://root-forum.cern.ch/u/Zesp)\
**Post date:** [May 26, 2013, 5:52pm UTC](https://root-forum.cern.ch/t/no-shadow-in-lego1/16148/1 "2013-05-26T17:52:00Z")

</div>

Hi there,

Attached is a patch not to plot shadowed faces in lego1 (git diff).  
It introduces the new option “noshadow” (see below)

`{
TH2D * histo = new TH2D ("histo","histo", 20,-5.,5., 20,-5.,5.) ; 
histo->FillRandom("gaus",1000) ;
histo->SetFillColor(kRed) ; 
histo->SetStats(kFALSE) ; 
TCanvas * canvas = new TCanvas ("canvas") ; 
canvas->Divide(2,1) ; 
canvas->cd(1) ; histo->Draw("lego1,fb") ;
canvas->cd(2) ; histo->Draw("lego1,fb,noshadow") ;
}`Could this (or any better version (gStyle?)) be committed to the trunk?

Cheers,  
Z  
[lego1\_noshadow.tgz](https://root-forum.cern.ch/uploads/default/original/2X/1/1d5018e0d881ec89755310369c49fa0d13ad2d28.tgz) (1015 Bytes)

 ![](https://root-forum.cern.ch/uploads/default/original/2X/0/0245387dbf123993eaecf22888767b71c559a434.png)

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [May 27, 2013, 7:20am UTC](https://root-forum.cern.ch/t/no-shadow-in-lego1/16148/2 "2013-05-27T07:20:49Z")

</div>

I think would be better to have another lego option … with a number.

---

<div class="post-metadata">

**Author:** ![Zesp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/b5ac83/32.png) [@Zesp](https://root-forum.cern.ch/u/Zesp)\
**Post date:** [May 27, 2013, 11:53am UTC](https://root-forum.cern.ch/t/no-shadow-in-lego1/16148/3 "2013-05-27T11:53:23Z")

</div>

[quote]I think would be better to have another lego option … with a number.[/quote]Or create the method TAttFill::SetFillShadowColor() since TColor::GetColorDark() depends on the palette used and may sometimes return weird colors (see below).

`{
Int_t pal=53 ;
gStyle->SetPalette(pal) ;
TH2D * histo = new TH2D ("histo",TString::Format("palette = %d",pal), 20,-5.,5., 20,-5.,5.) ;
histo->FillRandom("gaus",1000) ;
histo->SetStats(kFALSE) ;
histo->SetFillColor(TColor::GetColorDark(kRed)) ;
TCanvas * canvas = new TCanvas ("canvas") ;
histo->Draw("lego1,0,fb") ;
canvas->SaveAs(TString::Format("palette_%02d.png",pal)) ;
}`  
Cheers,  
Z

 ![](https://root-forum.cern.ch/uploads/default/original/2X/4/45dc2fb658030f639795af832ba33450936b8a30.png)  
  
 ![](https://root-forum.cern.ch/uploads/default/original/2X/8/883ed3e71985a3fa1326adfdc0de7e83ddc1f501.png)

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [May 27, 2013, 12:00pm UTC](https://root-forum.cern.ch/t/no-shadow-in-lego1/16148/4 "2013-05-27T12:00:21Z")

</div>

I still believe a new option is easier. What you suggest will introduce a new attribute, a new mechanism…  
Whereas LEGO3 (we have now LEGO, LEGO1, LEGO2), will simply be “like lego one without shadow”.  
It would prefer you implement that.

---

<div class="post-metadata">

**Author:** ![Zesp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/b5ac83/32.png) [@Zesp](https://root-forum.cern.ch/u/Zesp)\
**Post date:** [May 27, 2013, 12:14pm UTC](https://root-forum.cern.ch/t/no-shadow-in-lego1/16148/5 "2013-05-27T12:14:59Z")

</div>

As LEGO4 then since LEGO3 exists already

> [@](#):
>
> Like the option “LEGO1”, the option “LEGO3”  
> draws a lego plot using the hidden surface removal technique but doesn’t draw  
> the border lines of each individual lego-bar. This is very useful for histograms  
> having many bins. With such histograms the option “LEGO1” gives a black  
> image because of the border lines. This option also works with stacked legos.

---

<div class="post-metadata">

**Author:** ![Zesp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/b5ac83/32.png) [@Zesp](https://root-forum.cern.ch/u/Zesp)\
**Post date:** [May 27, 2013, 2:37pm UTC](https://root-forum.cern.ch/t/no-shadow-in-lego1/16148/6 "2013-05-27T14:37:14Z")

</div>

Lighter indeed 😉  
Cheers,  
Z  
[THistPainter.cxx.2.diff](https://root-forum.cern.ch/uploads/default/original/2X/3/36c186af722ff7b3d17cd8b74273963acc504ea0.diff) (1.87 KB)

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [May 27, 2013, 2:46pm UTC](https://root-forum.cern.ch/t/no-shadow-in-lego1/16148/7 "2013-05-27T14:46:31Z")

</div>

it seems you have not done the dif against the very latest trunk because when I apply your patch THistPainter does not compile.

---

<div class="post-metadata">

**Author:** ![Zesp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/b5ac83/32.png) [@Zesp](https://root-forum.cern.ch/u/Zesp)\
**Post date:** [May 27, 2013, 4:28pm UTC](https://root-forum.cern.ch/t/no-shadow-in-lego1/16148/8 "2013-05-27T16:28:45Z")

</div>

Oops, sorry about that.  
Attached’s the right file and below’s an example

`{
TH2D * histo = new TH2D ("histo","histo",20,-5.,5.,20,-5.,5.) ; 
histo->FillRandom("gaus",1000) ;
histo->SetStats(kFALSE) ; 
histo->SetFillColor(kRed) ;
histo->SetLineColor(kBlack) ;
TCanvas * canvas = new TCanvas ("canvas") ;
canvas->Divide(2,3) ;
canvas->cd(1) ; histo->SetTitle("lego ") ; histo->DrawClone("lego ,0,fb") ;
canvas->cd(2) ; histo->SetTitle("lego1") ; histo->DrawClone("lego1,0,fb") ;
canvas->cd(3) ; histo->SetTitle("lego2") ; histo->DrawClone("lego2,0,fb") ;
canvas->cd(4) ; histo->SetTitle("lego3") ; histo->DrawClone("lego3,0,fb") ;
canvas->cd(6) ; histo->SetTitle("lego4") ; histo->DrawClone("lego4,0,fb") ;
}`  
Cheers,  
Z  
[THistPainter.cxx.3.diff](https://root-forum.cern.ch/uploads/default/original/2X/2/2a18407f4d3902cdfe4acb46ebcea6910da9d266.diff) (1.94 KB)

 ![](https://root-forum.cern.ch/uploads/default/original/2X/c/c9ec91b1eb1d5cc4de207d8c2feaf492b04e5b22.png)

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [May 28, 2013, 8:02am UTC](https://root-forum.cern.ch/t/no-shadow-in-lego1/16148/9 "2013-05-28T08:02:59Z")

</div>

it does not work for me. See the screen dump.

 ![](https://root-forum.cern.ch/uploads/default/original/2X/b/b495a597cd4fc6f0b615cb7d435280b269dfe1f1.png)

---

<div class="post-metadata">

**Author:** ![Zesp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/b5ac83/32.png) [@Zesp](https://root-forum.cern.ch/u/Zesp)\
**Post date:** [May 28, 2013, 10:23pm UTC](https://root-forum.cern.ch/t/no-shadow-in-lego1/16148/10 "2013-05-28T22:23:13Z")

</div>

Ooops, sorry ☹  
That one should work better.  
Cheers,  
Z  
[THistPainter.cxx.4.diff](https://root-forum.cern.ch/uploads/default/original/2X/8/8780ce562f10f0895bbc43a657aec9eb9314c79a.diff) (2.44 KB)

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [May 29, 2013, 9:26am UTC](https://root-forum.cern.ch/t/no-shadow-in-lego1/16148/11 "2013-05-29T09:26:41Z")

</div>

Now in the trunk. I also modified the doc and the TH2 Editor.

---

<div class="post-metadata">

**Author:** ![Zesp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/b5ac83/32.png) [@Zesp](https://root-forum.cern.ch/u/Zesp)\
**Post date:** [May 29, 2013, 10:58am UTC](https://root-forum.cern.ch/t/no-shadow-in-lego1/16148/12 "2013-05-29T10:58:25Z")

</div>

Thanks Olivier.  
Bye,  
Z
