# Lego2 pdf transparency

**URL:** <https://root-forum.cern.ch/t/lego2-pdf-transparency/16175>\
**Category:** ROOT\
**Created:** [May 31, 2013, 5:52pm UTC](https://root-forum.cern.ch/t/lego2-pdf-transparency/16175 "2013-05-31T17:52:57Z")\
**Posts on this page:** 5\
**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 31, 2013, 5:52pm UTC](https://root-forum.cern.ch/t/lego2-pdf-transparency/16175/1 "2013-05-31T17:52:57Z")

</div>

Hi there,

When plotting a lego2 and saving it into pdf, it appears to be slightly transparent.  
[canvas\_pal01\_contour50.pdf](https://root-forum.cern.ch/uploads/default/original/2X/7/7220c399191e2a16fdd021f224d9f7af88085851.pdf) (16.2 KB)

`{
gStyle->SetLineScalePS(1) ;
TH2D * histo = new TH2D ("histo","", 3,-3.,3., 3,-3.,3.) ;
histo->SetBinContent(2,2,1.) ;
histo->SetStats(kFALSE) ;
histo->SetLineColor(kBlack) ;
histo->SetLineStyle(1) ;
histo->SetLineWidth(1) ;
Int_t pal=1 ;
Int_t contour=99 ;
gStyle->SetPalette(pal) ;
gStyle->SetNumberContours(contour) ;
TCanvas * canvas = new TCanvas ("canvas","canvas",0,0,800,800) ;
histo->Draw("lego2,fb") ;
canvas->SaveAs(TString::Format("canvas_pal%02d_contour%02d.pdf",pal,contour)) ;
}`  
This effect is directly related to the number of contours used.  
[canvas\_pal01\_contour99.pdf](https://root-forum.cern.ch/uploads/default/original/2X/8/8a1dc752357a2322a756f7db1876a6bfd295b9f7.pdf) (17.7 KB)[canvas\_pal01\_contour20.pdf](https://root-forum.cern.ch/uploads/default/original/2X/3/3fc027804c5877c27a3fdd2395b1dd0589164393.pdf) (15.1 KB)Actually the problem lies at the interface between 2 faces of different colors.

It does not seem related to the way the pdf file is read or created. I’ve tried several pdf readers and convert tools in vain.

Playing with gStyle-\>SetLineScalePS() does not help.

This is also not due to the new alpha parameter in TStyle::SetPalette() which by default is 1 (i.e. full opacity). See the plots below obtained with previous versions of Root (I work with the trunk release).  
[canvas\_5.32.00.pdf](https://root-forum.cern.ch/uploads/default/original/2X/5/510994c1a128964262b9345675e008060b06cfcd.pdf) (19.2 KB)[canvas\_5.27.04.pdf](https://root-forum.cern.ch/uploads/default/original/2X/f/fc0ea049175de9897ee3b5ca57107353b5e5cae1.pdf) (19.3 KB)  
Any ideas on how to avoid this?  
If need be, could it please be fixed?

Cheers,  
Z

---

<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:** [June 10, 2013, 6:24am UTC](https://root-forum.cern.ch/t/lego2-pdf-transparency/16175/2 "2013-06-10T06:24:55Z")

</div>

I do not see transparency in canvas\_pal01\_contour50.pdf

---

<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:** [June 10, 2013, 8:06pm UTC](https://root-forum.cern.ch/t/lego2-pdf-transparency/16175/3 "2013-06-10T20:06:15Z")

</div>

I do.  
Below’s what I get on screen.

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

See how the “artefacts” (grey-ish lines (violet indeed) inside the red ellipse) follow the ground border at the back (red dotted line).  
Can you see this in your pdf reader?

Cheers,  
Z

---

<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:** [June 11, 2013, 7:41am UTC](https://root-forum.cern.ch/t/lego2-pdf-transparency/16175/4 "2013-06-11T07:41:01Z")

</div>

it depends on the pdf reader you are using. With acrobat it does not dhow with Mac-Preview it does show. but thats not transparency that’s some artefact produced by the viewer when it renders polygon next to each other. You can see it with the super big zoom attached.  
 ![](https://root-forum.cern.ch/uploads/default/original/2X/a/ad87dc7f7e315d2fe6c45de34a14c058c696a53e.png)

 ![](https://root-forum.cern.ch/uploads/default/original/2X/5/53ca8a8bfcc119014cba0112911fe55912f2a7bd.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:** [June 11, 2013, 8:28am UTC](https://root-forum.cern.ch/t/lego2-pdf-transparency/16175/5 "2013-06-11T08:28:29Z")

</div>

Well done!  
I hadn’t played with the rendering settings enough ☹  
To remove these artefacts in Acrobat, just untick the “Smooth line art” checkbox (Edit / Preferences… / Page Display).

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

Pb solved 🙂

Cheers,  
Z
