# 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:** 1\
**Showing post:** 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

---

_[View the full topic](https://root-forum.cern.ch/t/lego2-pdf-transparency/16175)._
