How to include a R plot as a hyperlink

138 views
Skip to first unread message

Jeremy Wu

unread,
Oct 5, 2020, 9:21:21 AM10/5/20
to knitr
Hi, is it possible to include a R plot that is produced within R markdown and include it as a hyperlink in the final html file. The plot is not shown directly in the final html. Rather there is a hyperlink. Once you click it, the plot will be shown.

Yihui Xie

unread,
Oct 18, 2020, 12:31:22 AM10/18/20
to Jeremy Wu, knitr
This is definitely possible, but I don't have time to provide a full
answer. At least you could use JavaScript to change <img> to a link
<a> and add a click event on it to achieve what you wanted; or set a
knitr plot hook to generate the expected <a>:
https://bookdown.org/yihui/rmarkdown-cookbook/output-hooks.html

I'd recommend that you try other forums such as Stack Overflow or
RStudio Community. This mailing list has not really been active for a
few years...

Regards,
Yihui
--
https://yihui.org
Reply all
Reply to author
Forward
0 new messages