Re: [R] adding hyperlinked text to pdf plot

2011-12-07 Thread David M. Schruth

Hi Justin,

It sounds like you might be able to use the 'hyperplot()' function (in 
the 'caroline' package) for creating an html imagemap around your 
figure.  This is assuming all that you want to do is interactivate a 
2-dimensional scatter plot.  You'd also lose PDF-pagination but the 
auto-tabbing of most browsers from each independent hyperplot() call 
should help you stay organized.


Say you use hyperplot() like so:


library(caroline)

chr1 <- data.frame(pos=1:1000, cov=rnorm(1000,10,1), 
url=paste('http://my.genome.org/id=',1:1000,sep=''))

hyperplot(x='pos',y='cov', annout=chr1, link='url',
  xlab='position', ylab='coverage')

chr2 <- data.frame(pos=1:1000, cov=rnorm(1000,10,1), 
url=paste('http://my.genome.org/id=',1:1000,sep=''))

hyperplot(x='pos',y='cov', annout=chr2, link='url',
  xlab='position', ylab='coverage')
#chr3 <-
#...etc...


With this approach you'd have each chromosome on a different tab.

Cheers,

Dave




On 12/5/2011 12:20 PM, Yihui Xie wrote:

Sorry I experimented with tikzDevice using \href{}{} but failed.

You can probably try the old image hotspot technique in HTML. I
remember someone did this before in R, but I cannot find the link to
the work now. The key is your need to use the two functions grconvertX
and grconvertY.

Regards,
Yihui
--
Yihui Xie
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 2: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.

- Fincher


On Mon, Dec 5, 2011 at 14:09, Yihui Xie  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
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  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@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@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.


__
R-help@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.


Re: [R] adding hyperlinked text to pdf plot

2011-12-05 Thread Paul Murrell

Hi

On 6/12/2011 9:10 a.m., 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.


The 'gridSVG' package will let you associate a hyperlink with text (or 
anything else) and produce SVG that can then be viewed in a web page (as 
long as your plot is a 'lattice' or 'ggplot2' one).


Paul


- Fincher


On Mon, Dec 5, 2011 at 14:09, Yihui Xie  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
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  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@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@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.


--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
p...@stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/

__
R-help@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.


Re: [R] adding hyperlinked text to pdf plot

2011-12-05 Thread Yihui Xie
Sorry I experimented with tikzDevice using \href{}{} but failed.

You can probably try the old image hotspot technique in HTML. I
remember someone did this before in R, but I cannot find the link to
the work now. The key is your need to use the two functions grconvertX
and grconvertY.

Regards,
Yihui
--
Yihui Xie 
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 2: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.
>
> - Fincher
>
>
> On Mon, Dec 5, 2011 at 14:09, Yihui Xie  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 
>> 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  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@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@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.


Re: [R] adding hyperlinked text to pdf plot

2011-12-05 Thread Duncan Murdoch

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


__
R-help@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.


Re: [R] adding hyperlinked text to pdf plot

2011-12-05 Thread Justin Fincher
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.

- Fincher


On Mon, Dec 5, 2011 at 14:09, Yihui Xie  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 
> 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  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@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@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.


Re: [R] adding hyperlinked text to pdf plot

2011-12-05 Thread Yihui Xie
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 
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  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@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.

__
R-help@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.


Re: [R] adding hyperlinked text to pdf plot

2011-12-05 Thread David Winsemius


On Dec 5, 2011, at 1:39 PM, Justin Fincher 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.


Don't believe everything you read.

pdf("test.pdf")
 plot(1,1,main="http://test.gov/some.htm";)
 dev.off()

"Non-functioning" text.


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




David Winsemius, MD
West Hartford, CT

__
R-help@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.


Re: [R] adding hyperlinked text to pdf plot

2011-12-05 Thread Ted Harding
On 05-Dec-11 18:39:21, Justin Fincher 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

The "kosher" method of doing this kind of thing (and a host
of other interactive elements in a PDF file) would be to
incorporate a so-called PDFmark into the PDF code. See for
instance:

http://www.pdflib.com/developer/technical-documentation/
books/pdfmark-primer/

There are various ways of doing this in some document-preparation
programs, but I don't know whether it would be easy to do this
when creating a PDF in R. In mt experience, this involves first
passing via PostScript.

Any comments, anyone?

Ted.


E-Mail: (Ted Harding) 
Fax-to-email: +44 (0)870 094 0861
Date: 05-Dec-11   Time: 18:58:53
-- XFMail --

__
R-help@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.


[R] adding hyperlinked text to pdf plot

2011-12-05 Thread Justin Fincher
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@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.