Plotly: Cursor issue interacting with plotly plots

Created on 20 Jul 2016  路  6Comments  路  Source: ropensci/plotly

I have created several plots including a histogram, a surface plot, a boxplot, and a scatterplot, in a JS Reveal presentation. When I knit the presentation and open it in a browser the plots display, but when I try to select a data point to read the values of that point, the point directly beneath the cursor is not selected. Instead, a point up and to the left of the cursor is selected. This is also happening with a line graph and a scatter plot I have created using the htmlwidgets package. Is there a way that I can select data that is directly under the cursor? Any help would be greatly appreciated!

```{r} library(plotly) p <- plot_ly(midwest, x = percollege, color = state, type = "box") p ```

This is a sample r chunk that creates a histogram, but I cannot select the data directly beneath the cursor.

Most helpful comment

I think the code below solves the problem.

output: revealjs::revealjs_presentation: reveal_options: minScale: 1.0 maxScale: 1.0

All 6 comments

I think this was fixed in https://github.com/ropensci/plotly/commit/c50042553080d4d004a58a760f5f67588df1d2c4.

If you're still having a problem, please reopen and I'll address it

I'm facing the issue described here: https://github.com/rstudio/revealjs/issues/47

Consider the following minimal document:

``````

output: revealjs::revealjs_presentation #works with html_document

```{r plotly, message = FALSE, echo = FALSE}
library(ggplot2)
library(plotly)
g <- ggplot(mpg, aes(x = cty, y = hwy, colour = as.factor(cyl))) +
geom_point()
ggplotly(g)

``````

When using reveal.js, the cursor needs to be placed above and to the left of the points for the tooltip to trigger - rather than on top of them. This doesn't occur when using the default html_document style.

---
Below is my `sessionInfo()`

R version 3.4.1 (2017-06-30)

Platform: x86_64-redhat-linux-gnu (64-bit)

Running under: Red Hat Enterprise Linux Workstation 7.4 (Maipo)

Matrix products: default

BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:

[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C

[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8

[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8

[7] LC_PAPER=en_US.UTF-8 LC_NAME=C

[9] LC_ADDRESS=C LC_TELEPHONE=C

[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:

[1] stats graphics grDevices utils datasets methods base

other attached packages:

[1] plotly_4.7.1 ggplot2_2.2.1

loaded via a namespace (and not attached):

[1] Rcpp_0.12.12 compiler_3.4.1 plyr_1.8.4

[4] bindr_0.1 tools_3.4.1 digest_0.6.12

[7] jsonlite_1.5 evaluate_0.10.1 tibble_1.3.4

[10] gtable_0.2.0 viridisLite_0.2.0 pkgconfig_2.0.1

[13] rlang_0.1.2 shiny_1.0.5 crosstalk_1.0.0

[16] yaml_2.1.14 bindrcpp_0.2 stringr_1.2.0

[19] dplyr_0.7.3 httr_1.3.1 knitr_1.17

[22] htmlwidgets_0.9 revealjs_0.9 rprojroot_1.2

[25] grid_3.4.1 glue_1.1.1 data.table_1.10.4

[28] R6_2.2.2 rmarkdown_1.6 purrr_0.2.3

[31] tidyr_0.7.1 magrittr_1.5 backports_1.1.0

[34] scales_0.5.0 htmltools_0.3.6 assertthat_0.2.0

[37] xtable_1.8-2 mime_0.5 colorspace_1.3-2

[40] httpuv_1.3.5 labeling_0.3 stringi_1.1.5

[43] lazyeval_0.2.0 munsell_0.4.3

```

+1
Having the exact same problem as patzaw. Knitting revealjs presentations with plotly objects seems to make the cursor behave in a weird manner - to select points I actually have to hover to the top and left of them.

+1 having the same problem with plotly + revealjs

I think the code below solves the problem.

output: revealjs::revealjs_presentation: reveal_options: minScale: 1.0 maxScale: 1.0

@paulofelipe your solution worked for me.
Thanks!

Was this page helpful?
0 / 5 - 0 ratings