[R] Unwanted white borders on semi-transparent polygons?

Matthew Neilson matt at gneilson.plus.com
Fri Apr 27 13:40:17 CEST 2007


Hi Roger,

Yes, that's the FAQ to which I was referring in my original email. Unfortunately, turning off smoothing for line art (as suggested in the FAQ) did not work for me.

Many thanks,


-Matt



On Fri Apr 27 12:32 , Roger Bivand <Roger.Bivand at nhh.no> sent:

>Matt:
>
>Is this by any chance a version of FAQ 7.36, which turned out to be the 
>smooth line art flag in Adobe Reader?
>
>Roger
>
>
>
>On Fri, 27 Apr 2007, Matthew Neilson wrote:
>
>> Thanks for your fast response.
>> 
>> I'm using R version 2.1.1 on OS X 10.3.9 to create the pdfs. I have tried viewing the pdf output in both Acrobat 6 and 7 (both display a white border around each polygon) as well 
as 
>> Preview (displays fine). I have emailed the pdf file to some correspondents running Windows, and they also see white borders when viewing with Acrobat (version unspecified).
>> 
>> I have tried using R version 2.4.0 on a G5 machine (which I can access remotely) running OS X 10.4.8, but the resulting pdf renders incorrectly (i.e. with a white border around 
each 
>> polygon) in both Acrobat *and* Preview. So it would appear that the combination of R 2.1.1 and OS X 10.3.9 gives slightly better results - although plots still appear incorrect 
when 
>> printed or viewed in Acrobat.
>> 
>> Unfortunately, I don't have access to a Windows machine to test this out. Even if I did, many of my scripts include various Unix system calls so I don't think that would be a viable 
>> solution. Could this be a bug in the OS X pdf driver?
>> 
>> Many thanks,
>> 
>> 
>> -Matt
>> 
>> 
>> 
>> On 27 Apr 2007, at 06:42, Prof Brian Ripley wrote:
>> 
>> >What version of R, what OS, what version of Acrobat?
>> >
>> >I don't see this in 2.5.0 on Windows (using Acrobat 7: Acrobat does not 
>> >exist on Linux, AFAIK).  And reading the PDF produced shows no sign of an 
>> >extra object for the border.
>> >
>> >On Fri, 27 Apr 2007, Matthew Neilson wrote:
>> >
>> >> Hey all,
>> >>
>> >> I'm trying to create a plot of two semi-transparent regions. The reason they need to be partially transparent is so that I can see if there's any overlap. Here's some example 
code:
>> >>
>> >> # BEGIN
>> >>
>> >> pdf(file="test.pdf",version="1.4")
>> >> plot(0,0,type="l",ylim=range(-3,3),xlim=range(-1,5))
>> >> polygon(c(0,1,2,3,4,3,2,1,0), c(0,1,2,1,0,-1,-2,-1,0), col=rgb(1,0,0,0.5),
>> >> border=NA)
>> >> polygon(c(1,2,3,4,5,4,3,2,1), c(0,1,2,1,0,-1,-2,-1,0), col=rgb(0,0,1,0.5),
>> >> border=NA)
>> >> dev.off()
>> >>
>> >> # END
>> >>
>> >> The problem with this is that, despite setting "border = NA", I get a 
>> >> big white border surrounding each polygon!! Funnily enough, setting the 
>> >> alpha channel equal to 1 (as opposed to 0.5) *doesn't* give the border, 
>> >> but an alpha channel of 1 produces an opaque polygon! :S
>> >>
>> >> I have read the FAQ, and (unfortunately) turning off line-art smoothing 
>> >> does not give the desired effect. Furthermore, my pdfs print with a 
>> >> white border surrounding each transparent polygon.
>> >>
>> >> Now, here comes the really bizarre part. Whilst Adobe Acrobat displays 
>> >> the unwanted white border, Apple Preview respects the "border=NA" 
>> >> argument and shows the two diamonds as they are intended. However, 
>> >> opening up the pdf in Illustrator CS reveals that there is in fact a 
>> >> transparent (according to Illustrator) border *on top* of each diamond. 
>> >> Deleting these two borders (one for each polygon) and re-saving the pdf 
>> >> appears to correct the issue. So the obvious question is: how did the 
>> >> surrounding borders get there in the first place? A bug in the polygon 
>> >> function, perhaps?
>> >>
>> >> Does anyone have any ideas for preventing these unwanted borders around 
>> >> semi-transparent polygons (without having to resort to Illustrator)? Has 
>> >> anyone else even come across this problem?
>> >>
>> >> Many thanks,
>> >>
>> >>
>> >> -Matt
>> >>
>> >
>> >-- 
>> >Brian D. Ripley,                  ripley at stats.ox.ac.uk
>> >Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
>> >University of Oxford,             Tel:  +44 1865 272861 (self)
>> >1 South Parks Road,                     +44 1865 272866 (PA)
>> >Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>> 
>> ______________________________________________
>> R-help at stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>> 
>
>-- 
>Roger Bivand
>Economic Geography Section, Department of Economics, Norwegian School of
>Economics and Business Administration, Helleveien 30, N-5045 Bergen,
>Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
>e-mail: Roger.Bivand at nhh.no
>



More information about the R-help mailing list