0

My goal is to plot with R a colored map of the human body, and will use here the simplified example of a smiley. I see two options but am stuck with both:

1) Extracting the different areas of the body using photoshop, and then plotting them on the top of each other:

R
link = "http://images.clipartpanda.com/clipart-smiley-face-9czEnApcE.jpeg"
download.file(link,basename(link))
jj <- readJPEG("clipart-smiley-face-9czEnApcE.jpeg",native=TRUE)
plot(1, type="n", axes=F, xlab="", ylab="")
rasterImage(jj,0.7,0.6,1,1)

I look for a way to do something like

rasterImage(jj,0.7,0.6,1,1, col="yellow")

But rasterImage works only with opaque pictures :/

2) Defining a polygon by interactively clicking on the picture, save that polygon to plot it later on the top of the original pic. That way I could simply create a map of the human body. But most maps are for countries and so rely on available geographical data.

Is there a way to "draw" in R lines and define polygons in an easy way?

Xavier Prudent
  • 1,231
  • 1
  • 18
  • 41
  • The answers to the question ["plot human body in 2d"](http://stackoverflow.com/questions/10670751/r-plot-human-body-in-2d) might help you. Check it out. – yeedle Sep 07 '16 at 17:22
  • looks indeed like the grImport package may do the job, I had missed that answer while scrolling by – Xavier Prudent Sep 07 '16 at 19:33

0 Answers0