悬停以在ggplot2中显示图像或图标(R标记)

悬停以在ggplot2中显示图像或图标(R标记),r,ggplot2,r-markdown,R,Ggplot2,R Markdown,我对动态或交互式图形很着迷。我在ggiraph中找到了一些简单的悬停选项,这里是R减价的MWE: --- title: "Hover" author: "Author" output: html_document --- ## Hover ggplot2 ```{r, warning=FALSE, message=FALSE} library(ggplot2) library(ggiraph) data <- mtcars data$carname

我对动态或交互式图形很着迷。我在
ggiraph
中找到了一些简单的悬停选项,这里是R减价的MWE:

---
title: "Hover"
author: "Author"
output: html_document
---
## Hover ggplot2
```{r, warning=FALSE, message=FALSE}
library(ggplot2)
library(ggiraph)
data <- mtcars
data$carname <- row.names(data)
gg_point = ggplot(data = data) +
    geom_point_interactive(aes(x = wt, y = qsec, color = disp,
    tooltip = carname, data_id = carname)) +
  theme_minimal()
girafe(ggobj = gg_point)
```
---
标题:“悬停”
作者:“作者”
输出:html\u文档
---
##悬停ggplot2
```{r,warning=FALSE,message=FALSE}
图书馆(GG2)
图书馆(ggiraph)

data是一个博客,它几乎可以满足您的需求,只需要使用plotly和一点JavaScription。这看起来很有希望,但我无法实现它。我试图用setosa.jpg、virginica.jpg和versicolor.jpg复制这个示例,但它不起作用。我的RStudio或RMarkdown中没有图像。