jpeg - R - use jpg as background -


i trying create snakes & ladders board. have found image online wish use background, have been unable so. if show me how remove x & y axis' final image great. link jpg is:

http://images8.alphacoders.com/448/448009.jpg

the plot code using is

plot(x,y, pch=19, cex=5, col='red', xlim=c( 0, 6),ylim=c( 0, 5)) 

use readjpeg jpeg library read jpeg; use rasterimage plot it

# download jpeg file, save read in (jpeg package doesn't #  download url) download.file('http://images8.alphacoders.com/448/448009.jpg', destfile='bg.jpg') library(jpeg) jp <- readjpeg('bg.jpg')  # plot background. coordinates same x/y scale. rasterimage(jp, xleft=0, xright=6, ybottom=0, ytop=5)  # plot dots on top x <- sample(6, 10, replace=t)-.5 y <- sample(5, 10, replace=t)-.5 points(x,y, pch=19, cex=5, col='black', xlim=c( 0, 6),ylim=c( 0, 5)) 

enter image description here


Comments