Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cursor issue interacting with plotly plots #648

Closed
johncarew opened this issue Jul 20, 2016 · 7 comments
Closed

Cursor issue interacting with plotly plots #648

johncarew opened this issue Jul 20, 2016 · 7 comments

Comments

@johncarew
Copy link

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.

@cpsievert
Copy link
Collaborator

I think this was fixed in c500425.

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

@patzaw
Copy link

patzaw commented Sep 27, 2017

I'm facing the issue described here: rstudio/revealjs#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

@riccardopinosio
Copy link

+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.

@paulofelipe
Copy link

+1 having the same problem with plotly + revealjs

@paulofelipe
Copy link

I think the code below solves the problem.

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

@mauritzvdworm
Copy link

@paulofelipe your solution worked for me.
Thanks!

@cderv
Copy link

cderv commented Sep 17, 2021

For anyone still coming to this issue, the dev version of plotly is the one to use to solve this (specifically for revealjs) as it updates the version of plotly.js which has the fix for this.
Details in rstudio/revealjs#47 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants