Open hyperlink on click on an ggplot/plotly chart
问题 This is a follow up question on the answer provided for Add onclick open hyperlink event to an html widget created in R. Consider the following example: library(ggplot2) library(plotly) library(htmlwidgets) library(htmltools) myData <- data.frame( x=c(1,2,3), y=c(3,2,1), label=c("Google", "Bing", "R"), category=c("search", "search", "other"), urls=c("http://google.de", "http://bing.com", "http://r-project.org") ) f <- function(p) { ply <- ggplotly(p) javascript <- HTML(paste(" var myPlot =