Lego2 pdf transparency

Hi there,

When plotting a lego2 and saving it into pdf, it appears to be slightly transparent.
canvas_pal01_contour50.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 (17.7 KB)canvas_pal01_contour20.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 (19.2 KB)canvas_5.27.04.pdf (19.3 KB)
Any ideas on how to avoid this?
If need be, could it please be fixed?


I do not see transparency in canvas_pal01_contour50.pdf

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

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?


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.

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

Pb solved :slight_smile: