[R] Using an image background with graphics

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Oct 21 07:46:07 CEST 2008


Most likely this is a bug in your pdf viewer: try turning off 
anti-aliasing there (or use a better viewer, if that is not an option).
It is a symptom of anti-aliasing of the rectangles used to plot image 
pixels.

You haven't told us which 'a pdf device' and there are several for R, 
depending on the OS.  pdf() does not do this, nor does cairo_pdf().
Some of the third-party devices did last time I looked.

On Mon, 20 Oct 2008, Waichler, Scott R wrote:

> Greg,
>
>> The rimage package has functions for reading in and plotting
>> jpeg files that you could use for displaying the photograph.
>> If you then can find 2 points in the image (not on the same
>> horizontal or vertical line) for which you know the
>> coordinates in the coordinate system that you want to plot
>> in, then you can use the updateusr function from the
>> TeachingDemos package to set the user coordinates, then use
>> points/lines or other functions that can add to the current
>> plot (e.g. contour with add=TRUE) to overlay the information
>> of interest to the plot.
>
> I tried this, and your approach works great except for one thing.  I
> would like to plot to a pdf device, and when I do so my grayscale image
> takes on a gridded appearance, with thick horizontal and vertical lines
> of lighter gray.  These don't appear of course if I use jpeg() instead
> of pdf().  How can I get rid of those?
>
> Thanks,
> Scott Waichler
> scott.waichler at pnl.gov

-- 
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



More information about the R-help mailing list