r - 带有 revealjs r markdown 演示文稿的 ggplotly 工具提示

标签 r r-markdown reveal.js htmlwidgets

我正在使用 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 执行此操作。在浏览器中不同的缩放级别,工具提示会离悬停信息出现的点更近或更远。

有人遇到过这个吗?

最佳答案

我遇到了同样的问题,这是我发现的:

  1. 有据可查 here , herehere .
  2. 解决方法:将绘图放在 widgetframe::frameWidget() 中,参见 here .
  3. 解决方案:添加以下 reveal_options(参见 here):
reveal_options:
  minScale: 1.0
  maxScale: 1.0

现在一切似乎都在按预期工作。

关于r - 带有 revealjs r markdown 演示文稿的 ggplotly 工具提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46934566/

相关文章:

r - 如何使内联 r 脚本在 RMarkdown 报告中可见?

javascript - 使用 Pandoc 的独立的 Reveal.js 文件,没有相对的 Reveal.js 文件夹

javascript - 如何让jquery函数一次运行一个

r - ggplot : placing facet strips above axis title

r - 从坐标点创建分区统计图

r - 在 R 中将数字转换为逻辑数据帧

css - ioslides : place title logo on the right side

r - 在 Rmarkdown 中指定默认 kableExtra 样式的选项

javascript - reveal.js 标题幻灯片覆盖

r - 如何删除 R 中传单 map 中的归因