Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

plotting points on top of image in R

These days I am extensively using R to scatter plots. Most of the plotting is concerned with image processing, Recently I was thinking of plotting the scatter plots over an image.

For example, I want something like this, The background needs to be filled with my image. With a particular scale. And I should be able to draw points (co-ordinates) on top of this image ...

Is this possible in R? If not, do you guys know of any other tool that makes this easy ...

like image 253
Alphaneo Avatar asked Sep 09 '09 06:09

Alphaneo


2 Answers

I'm not 100% sure what you have in mind, but I think first you want to load and plot an image in R. You can do that with the ReadImages package:

picture <- read.jpeg("avatar.jpg")
plot(picture)

Then you can do a scatter plot on top of it:

points(runif(50,0, 128), runif(50,0,128))
like image 121
Jonathan Chang Avatar answered Nov 14 '22 04:11

Jonathan Chang


A step-by-step tutorial to this kind of plotting is in the R-wiki

like image 24
Aaron Statham Avatar answered Nov 14 '22 02:11

Aaron Statham