[R] import a bitmap image and add it to graphics display

Wolfram Fischer wolfram at fischer-zim.ch
Thu Aug 5 11:03:40 CEST 2004


> Hello
> 
> Is there a possibility to import and add a bitmap image (png or 
> similar) to a R graphics display. It would be helpful e.g. to
> locate positions of points of a scanned map or to add a background
> to a R graphic.
> 
> Wolfram

I found the package pixmap with the functions
	x <- read.pnm( file )
and
	plot(x)
This plots pnm pictures as R graphics.
(Other picture formats can be converted to pnm pictures
by several pnm commands on Linux or by using gimp.)

Overlaying such a picture with a graph could be done as follows:
    library(pixmap)
    example(pixmap)
    plot(x)
    m <- 20 ; points( x=m*c(0,1,2), y=m*c(0,2,1), col='red', type='b', lwd=5 )

There rests a problem with the scale:
Question: How can I scale a pixmap object?

Wolfram




More information about the R-help mailing list