[R] Using an image background with graphics

Greg Snow Greg.Snow at imail.org
Tue Oct 14 04:40:11 CEST 2008

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.

Also look at the squishplot function in TeachingDemos for one way to set the aspect ratio of the original image.

Hope this helps,

From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] On Behalf Of Waichler, Scott R [Scott.Waichler at pnl.gov]
Sent: Monday, October 13, 2008 3:02 PM
To: r-help at stat.math.ethz.ch
Subject: [R] Using an image background with graphics

I would like to use a map or aerial photo as a background to plotting
solid lines and text, and semi-transparent color contours, in base and
lattice graphics.  Plot coordinates need to be consistent with the
georeferenced background.  For example, a color contour plot would have
an gray-toned aerial photograph as a background for overprinted
semi-transparent color contours of some spatially dependent variable.
Can anyone point me in the right direction on how to do this?

Scott Waichler
Pacific Northwest National Laboratory
scott.waichler at pnl.gov

R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list