【问题标题】:ggplotly tooltip with revealjs r markdown presentation带有revealjs r markdown演示的ggplotly工具提示
【发布时间】:2017-10-25 14:04:11
【问题描述】:

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

有人遇到过这种情况吗?

【问题讨论】:

    标签: r r-markdown reveal.js htmlwidgets


    【解决方案1】:

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

    1. hereherehere 都有很好的记录。
    2. 解决方法:将绘图放在 widgetframe::frameWidget() 中,参见 here
    3. 解决方案:添加以下reveal_options(参见here):
    reveal_options:
      minScale: 1.0
      maxScale: 1.0
    

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

    【讨论】:

      【解决方案2】:

      如果这对任何人都有帮助,这似乎与缩放完全相关。

      在浏览器中放大 140% 时,我正在使用的所有 htmlwidgetshighcharterplotly)在工具提示和我悬停的点之间正确对齐。

      可能也取决于屏幕大小和浏览器。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-11-21
        • 1970-01-01
        • 1970-01-01
        • 2018-11-26
        • 2019-08-22
        • 1970-01-01
        • 2016-02-27
        相关资源
        最近更新 更多