[R] Plotting using image files

Romain Francois francoisromain at free.fr
Tue Aug 23 16:55:00 CEST 2005


Le 23.08.2005 14:52, Mike Saunders a écrit :

>This is a strange request, but I want to build a scatterplot using different image files (jpegs, gif, etc.) as the plot symbols.  I have thought about setting this up using a very large layout matrix, but I thought someone might have a better approach.  Furthermore, is there any way to have R paste an image file into a specific coordinate within a scatterplot?
>
>Thanks in advance,
>Mike 
>
>  
>
Hello Mike,

Maybe you can try using the pixmap package, something like this :

require(pixmap)
logo <- read.pnm(system.file("pictures/logo.ppm", package="pixmap")[1])
x <- rnorm(10)
y <- rnorm(10,sd=.4)+x
plot(x,y, type="n")
for(i in 1:10){       
                  u <- runif(1)/10 + .1
                  addlogo(logo, x[i]+c(-u,u), y[i]+c(-u,u), asp=1)
}
# points(x,y, pch="+")

All you have to de then is having your images in ppm format. I think 
gimp will do it for you.
There is also a few tools in netpbm (only on linux i think).


Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~
~~~~~~      Romain FRANCOIS - http://addictedtor.free.fr         ~~~~~~
~~~~        Etudiant  ISUP - CS3 - Industrie et Services           ~~~~
~~                http://www.isup.cicrp.jussieu.fr/                  ~~
~~~~           Stagiaire INRIA Futurs - Equipe SELECT              ~~~~
~~~~~~   http://www.inria.fr/recherche/equipes/select.fr.html    ~~~~~~
~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~




More information about the R-help mailing list