Imagemaps and R
How the WWW WWWorks Hyperlinks and Imagemaps R Plots to Imagemaps
Imagemaps and R How the WWW WWWorks Hyperlinks and Imagemaps R - - PowerPoint PPT Presentation
Imagemaps and R How the WWW WWWorks Hyperlinks and Imagemaps R Plots to Imagemaps Clients and Servers Server Client Clients and Servers runs runs web browser web server Clients and Servers browser sends http request to server
How the WWW WWWorks Hyperlinks and Imagemaps R Plots to Imagemaps
web browser web server
web browser renders html web server browser sends http request to server server sends response to client browser
user clicks here Read more about Foo
user clicks here
user clicks here
user clicks here
Write R code to make the plot. Create a graphics file plot. Write the HTML MAP code.
}
Use the png() or jpeg() functions. Create the plot Close the graphics device.
Can now show a clickable R plot on the web:
Problem now is writing the <map> parts...
<html> <head><title>Imagemap from R</title></head> <body> <img src="outlier.png" usemap="#outlier" border="0" ISMAP> <map name="outlier"> <area shape="rect" coords="51,403,94,392" href="notOutlier.html"> <area shape="rect" coords="94,412,136,400" href="notOutlier.html"> <area shape="rect" coords="179,258,222,247" href="notOutlier.html"> <area shape="rect" coords="222,244,264,232" href="notOutlier.html"> <area shape="rect" coords="264,218,307,206" href="notOutlier.html"> <area shape="rect" coords="307,240,350,228" href="notOutlier.html"> <area shape="rect" coords="350,171,392,160" href="notOutlier.html"> <area shape="rect" coords="392,118,435,106" href="notOutlier.html"> <area shape="rect" coords="435,85,477,73" href="notOutlier.html"> <area shape="rect" coords="136,98,179,87" href="isOutlier.html"> </map> </body> </html>
<html> <head><title>Imagemap from R</title></head> <body> <img src="outlier.png" usemap="#outlier" border="0" ISMAP> <map name="outlier"> <area shape="rect" coords="51,403,94,392" href="notOutlier.html"> <area shape="rect" coords="94,412,136,400" href="notOutlier.html"> <area shape="rect" coords="179,258,222,247" href="notOutlier.html"> <area shape="rect" coords="222,244,264,232" href="notOutlier.html"> <area shape="rect" coords="264,218,307,206" href="notOutlier.html"> <area shape="rect" coords="307,240,350,228" href="notOutlier.html"> <area shape="rect" coords="350,171,392,160" href="notOutlier.html"> <area shape="rect" coords="392,118,435,106" href="notOutlier.html"> <area shape="rect" coords="435,85,477,73" href="notOutlier.html"> <area shape="rect" coords="136,98,179,87" href="isOutlier.html"> </map> </body> </html>
symbols(8.5,8.5,circle=1.5,add=TRUE,inches=F)
addRegion(im) = imCircle(8.5,8.5,1.5,href="imCircle.html")
msg = expression(paste("imText: ",hat(beta) == (X^t * X)^{-1} * X^t * y,sep='')) text(2,4, msg, srt=45)
addRegion(im) = imText(2,4,msg,pars=list(srt=45),href="imText.html")
rect(6.1,2.1,7,2.9) text(6.5,2.5,'hole') rect(6,2,10,4) text(8,3,'imRect(1)') rect(5,1,10.2,4.2) text(6,1.3,'imRect(2)')
addRegion(im) = imRect(6.1,2.1,7,2.9) addRegion(im) = imRect(6,2,10,4,href="imRect-1.html") addRegion(im) = imRect(5,1,10.2,4.2,href="imRect-2.html")
xy <- cbind(c(2.9,1.3,2.4,4.2,4.6,2.9), c(9.8,8.8,7.0,7.0,8.6,9.8)) lines(xy)
addRegion(im) = imPoly(xy,href="imPoly.html")
addRegion(im) = imDefault(href="imDefault.html")