Alphaneo
Alphaneo

Reputation: 12539

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

Upvotes: 12

Views: 6489

Answers (2)

Jonathan Chang
Jonathan Chang

Reputation: 25327

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

Upvotes: 9

Aaron Statham
Aaron Statham

Reputation: 2068

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

Upvotes: 8

Related Questions