[R] Artifacts in pdf() of image() (w/o comments)
Michael Kubovy
kubovy at virginia.edu
Mon Aug 13 17:07:08 CEST 2007
Dear Friends,
Thanks for your input.
FYI: Preview doesn't show PDF aliasing in the image I produced if I
uncheck the "Anti-alias text and line art" box under the PDF tab in
Preferences. So I'm not yet ready to drop Preview from my toolbox.
MK
On Aug 13, 2007, at 12:02 AM, Mark Wardle wrote:
> It may be worth outputting postscript and converting to PDF from
> there. Although Preview can do this, it may be worth looking at
> Ghostscript which *may* not have simila problems.
>
> I have also had PDFs which have displayed well in Preview and open
> source tools and have been garbled in Adobe Acrobat, so the problems
> aren't limited to Preview.
>
> Best wishes,
>
> Mark
>
> On 13/08/07, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
>
>> Michael Kubovy wrote:
>>> On Aug 12, 2007, at 6:24 AM, Duncan Murdoch wrote:
>>>
>>>> Michael Kubovy wrote:
>>>>
>>>>> Dear r-helpers,
>>>>>
>>>>> In my previous message there were comments in the code that may
>>>>> have made cutting and pasting awkward. Here it is w/o them.
>>>>>
>>>>> I have two questions:
>>>>>
>>>>> (1) The following produces a pdf with artifacts. How do I prevent
>>>>> them?
>>>>>
>>>>>
>>>> What artifacts do you see? It looks like a smoothly varying field
>>>> when produced by R 2.5.1 and viewed in Acrobat Reader 6.0 on
>>>> Windows.
>>>>
>>>> Duncan Murdoch
>>>>
>>>>> require(grDevices)
>>>>> imSize <- 200
>>>>> lambda <- 10
>>>>> theta <- 15
>>>>> sigma <- 40
>>>>> x <- 1:imSize
>>>>> x0 <- x / imSize -.5
>>>>> freq = imSize/lambda
>>>>> xf = x0 * freq * 2 * pi
>>>>> f <- function(x, y){r <- -((x^2 + y^2)/(sigma ^2)); exp(r)}
>>>>> z <- outer(xf, xf, f)
>>>>> f1 <- function(x, y){cos(.1 * x)}
>>>>> z1 <- outer(xf, xf, f1)
>>>>> pdf('gabor.pdf')
>>>>> image(xf, xf, z * z1, col = gray(250:1000/1000),
>>>>> xlab = '', ylab = '', bty = 'n', axes = FALSE, asp = 1)
>>>>> dev.off()
>>>>>
>>>
>>> I'm working on a Mac. You're right, Acrobat 6.05 renders the figure
>>> nicely, but when it's included in a LaTeX-produced pdf or viewed
>>> with
>>> the Mac Preview program, a grid of fine white lines is superimposed
>>> on the figure. So I believe that it's a matter of aliasing, which I
>>> might be able to prevent by adjusting the parameters of the figures.
>>> I just don't know enough to figure this out, and would appreciate
>>> guidance.
>> I see the artifacts in Preview on a Mac too. So it looks to me
>> like a
>> Mac bug.
>>
>> Preview is actually pretty poor at graphics display; see
>> <http://www.geuz.org/pipermail/gl2ps/2007/000223.html>.
>>
>> My only suggestion is not to use Preview.
>>
>> Duncan Murdoch
> --
> Dr. Mark Wardle
> Clinical research fellow and specialist registrar, Neurology
> Cardiff, UK
_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400 Charlottesville, VA 22904-4400
Parcels: Room 102 Gilmer Hall
McCormick Road Charlottesville, VA 22903
Office: B011 +1-434-982-4729
Lab: B019 +1-434-982-4751
Fax: +1-434-982-4766
WWW: http://www.people.virginia.edu/~mk9y/
More information about the R-help
mailing list