[R] adding bmp/jpg/gif to an existing plot

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Dec 3 16:27:04 CET 2009


Look at the R-devel development version of R

     o	The graphics engine now supports rendering of raster (bitmap)
 	images, though not all graphics devices can provide (full)
 	support.  Packages providing graphics devices (e.g., Cairo,
 	RSvgDevice, cairoDevice) will need to be reinstalled.

and

http://developer.r-project.org/Raster/raster-RFC.html

for more details (and older ways to do it less well).


On Thu, 3 Dec 2009, Cézar Freitas wrote:

> Hi, all.
>
> I searched a lot at mailing list, installed EBImage and gtk packages, but I couldn't make this simple work:
>
> How
> to add a image file (jpg or bmp ou gif) to an existing plot window (not
> plot over the image), like the code below (pseudo function add.image):
>
>
>
>
> plot(1:10,1:10,main="test")
>
> image = read.X("myimage.jpg")
>
>
>
> add.image(image, x.left=2, y.bottom=4, size="40%") #points the left-bottom corner and the reative size of image
>
>
>
>
> abline(x=3, col=2, lwd=2) #continues editing the plot window.
>
> text(2,3,labels="example of graphics and image")
>
>
>
> Is it possible?
>
>
>
> Thanks,
>
> Cezar Freitas
>
>
>      ____________________________________________________________________________________
> Veja quais s?? os assuntos do momento no Yahoo! +Buscados
> http://br.maisbuscados.yahoo.com
> 	[[alternative HTML version deleted]]
>
>

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