Zesp
May 26, 2013, 5:52pm
1
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 (1015 Bytes)
couet
May 27, 2013, 7:20am
2
I think would be better to have another lego option … with a number.
Zesp
May 27, 2013, 11:53am
3
[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
couet
May 27, 2013, 12:00pm
4
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.
Zesp
May 27, 2013, 12:14pm
5
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.
Zesp
May 27, 2013, 2:37pm
6
Lighter indeed
Cheers,
Z
THistPainter.cxx.2.diff (1.87 KB)
couet
May 27, 2013, 2:46pm
7
it seems you have not done the dif against the very latest trunk because when I apply your patch THistPainter does not compile.
Zesp
May 27, 2013, 4:28pm
8
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 (1.94 KB)
couet
May 28, 2013, 8:02am
9
it does not work for me. See the screen dump.
Zesp
May 28, 2013, 10:23pm
10
Ooops, sorry
That one should work better.
Cheers,
Z
THistPainter.cxx.4.diff (2.44 KB)
couet
May 29, 2013, 9:26am
11
Now in the trunk. I also modified the doc and the TH2 Editor.