[R] adding hyperlinked text to pdf plot

Duncan Murdoch murdoch.duncan at gmail.com
Mon Dec 5 21:20:37 CET 2011


On 05/12/2011 3:10 PM, Justin Fincher wrote:
> For example, say I am plotting some data that is genomic and therefore
> maps to a specific locus on the human genome, like a gene.  I was
> hoping to have the title of the plot display the gene name, but have
> it be a link so that clicking on it would take you to those
> coordinates on a public browser, like USCS's genome browser.  So
> basically, I was hoping to have text in a plot generated by R function
> as a normal html-style link.

Just use Sweave, and put the URL in a LaTeX \href{URL}{text} tag, not in 
the R code.  This can be generated in R code in
\Sexp{}.  It's not part of the PDF image, but it's part of the final 
document.

Duncan Murdoch
> - Fincher
>
>
> On Mon, Dec 5, 2011 at 14:09, Yihui Xie<xie at yihui.name>  wrote:
> >  It seems I missed the context of this post -- who is "you", and what
> >  is "something other than the URL"?
> >
> >  I feel the tikzDevice package should be an option for the task.
> >
> >  Regards,
> >  Yihui
> >  --
> >  Yihui Xie<xieyihui at gmail.com>
> >  Phone: 515-294-2465 Web: http://yihui.name
> >  Department of Statistics, Iowa State University
> >  2215 Snedecor Hall, Ames, IA
> >
> >
> >
> >  On Mon, Dec 5, 2011 at 12:39 PM, Justin Fincher<fincher at cs.fsu.edu>  wrote:
> >>  Howdy,
> >>     I have read that if you put a URL in the text of a plot being saved
> >>  into pdf, the result is a functional hyperlink. I am interested in
> >>  having text in a plot that is linked to a URL, but I would like the
> >>  text to be something other than the URL. Is this possible? Thank you.
> >>
> >>  - Fincher
> >>
> >>  ______________________________________________
> >>  R-help at r-project.org mailing list
> >>  https://stat.ethz.ch/mailman/listinfo/r-help
> >>  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> >>  and provide commented, minimal, self-contained, reproducible code.
> >
> >  --
> >  This message has been scanned for viruses and
> >  dangerous content by MailScanner, and is
> >  believed to be clean.
> >
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list