Re: [R] Plotting using image files

From: Greg Snow <greg.snow_at_ihc.com>
Date: Wed 24 Aug 2005 - 00:59:04 EST

>>> "Mike Saunders" <mike_saunders@umenfa.maine.edu> 08/23/05 06:52AM
>>>

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

Here is an example using cnvrt.coords from the TeachingDemos package and the jpeg plotting functions from the rimage package:

library(TeachingDemos)
library(rimage)
data(logo)

x <- runif(10,3,6)
y <- runif(10,100,200)

plot(x,y, type='n')

cp <- par(no.readonly=TRUE)
tmp <- cnvrt.coords(x,y)

for (i in 1:10){
  par(plt=c(tmp$dev$x[i] + c(-0.03,0.03), tmp$dev$y[i] + c(-0.03,0.03)),

      new=TRUE)
  plot(logo)
}

par(cp)

hope this helps,

Greg Snow, Ph.D.
Statistical Data Center, LDS Hospital
Intermountain Health Care
greg.snow@ihc.com
(801) 408-8111



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Aug 24 01:03:39 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:44:32 EST