[R] Functionality of pdf()
Barry Rowlingson
B.Rowlingson at lancaster.ac.uk
Wed May 21 14:19:02 CEST 2003
hgoehlmann at gmx.de wrote:
> Hello,
>
> this might be too much to ask, but just a thought... There are some
> efforts in the bioconductor area where people create functions to produce html
> tables which include links to current information. Would there be any chance
> that somebody can implement a similar functionality in the pdf device, so that
> you can not only create a graph but can also create a "clickable" graph with
> link to current information?
>
On a related note, I've just finished some R code to produce HTML
imagemaps. You do something like this:
im <- imagemap("Test",height=400,width=400)
plot(1:10,1:10)
addRegion(im) <- imCircle(5,5,.3,href="Point5.html")
createPage(im,file="Test.html")
imClose(im)
This produces Test.html and Test.png. When Test.html is viewed, you see
the plot and can click within 0.3 units of the fifth point to go to the
given URL.
You can add rectangular, circular and polygonal clickable regions. You
can specify a default for a click anywhere else. You can even have
clickable rotated text or expressions. You can use par(mfrow=...) and
have several plots with clickable bits on each one.
Instead of createPage() you can call createIM() which will produce
HTML Imagemap code for including into a web page.
There's some horribly tricksy stuff involved in getting the right
coordinates in the PNG file, and some limitations. Currently it cant
deal with log-axes, and you cant do dev.copy() to put stuff in the PNG.
But what it can do is quite useful.
The documentation is sparsish, but once I've written some more
examples and .Rd files I'll announce it to the world.
Baz
More information about the R-help
mailing list