我正在使用 rmarkdown .Rmd
文件创建一个 revealjs_presentation
。
但是,当我使用 ggplotly
创建图表时,悬停时工具提示不再与点对齐。这是一个例子:
---
title: ""
output:
revealjs::revealjs_presentation:
center: true
---
```{r setup, include=FALSE}
library(tidyverse)
library(plotly)
```
Plotly
------------------------------
```{r, echo=F, message=F}
(ggplot(mtcars, aes(wt, mpg)) + geom_point()) %>%
ggplotly()
```
它不会用 output: html_document
执行此操作。在浏览器中不同的缩放级别,工具提示会离悬停信息出现的点更近或更远。
有人遇到过这个吗?
最佳答案
我遇到了同样的问题,这是我发现的:
- 有据可查 here , here和 here .
- 解决方法:将绘图放在
widgetframe::frameWidget()
中,参见 here . - 解决方案:添加以下 reveal_options(参见 here):
reveal_options:
minScale: 1.0
maxScale: 1.0
现在一切似乎都在按预期工作。
关于r - 带有 revealjs r markdown 演示文稿的 ggplotly 工具提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46934566/