gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-05 02:17:50 25 4
gpt4 key购买 nike

我正在使用 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com