When I was still using R 3.4, and made interactive plots with Plotly, the plot printed properly under the code chunk that produced it inside the R notebook. However, ever since I upgraded to R 3.5, the Plotly plot prints in the viewer pane inside RStudio instead of inside the R notebook. The plot also does not show up in the html notebook. The plot is correct and interaction still works properly for both 2D and 3D plots, and no error or warning messages are generated. Is there something I can do to fix this problem or is this something about R 3.5? I'm using the newest version of Plotly, RStudio version 1.1.447 on MacOS High Sierra.
Any way you can turn this issue into a minimal reprex .Rmd? .
This is a known bug related to how some changes in R 3.5.0 affect some of RStudio’s magic , and it looks like a patch should be out soon. See here for more info:
opened 12:14PM - 14 May 18 UTC
closed 09:48PM - 15 May 18 UTC
I have an issue when using plotly in markdown:
- When i run a plotly command, t… he plot appears in the viewer rather than in the markdown document. How can i force it to render inline?
- When i knit to html, the markdown version works as expected but in the notebook version, there is no plot.
### System details
RStudio Edition : Desktop
RStudio Version : 1.1.447
OS Version : macOS Sierra 10.12.3
R Version : 3.5.0
### Steps to reproduce the problem
here's an example code: the normal plot works fine but the plotly plot displays in viewer rather than inline and doesn't display when knitting to notebook:
`
title: "R Notebook"
output:
html_notebook: default
html_document: default
```{r}
plot(cars)
```
```{r}
library(plotly)
plot_ly(cars,
x=~speed, y=~dist, type = 'scatter', mode = 'markers')
```
`
sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.3
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] knitr_1.20 lubridate_1.7.4 bindrcpp_0.2.2 plotly_4.7.1.9000 readxl_1.1.0
[6] forcats_0.3.0 stringr_1.3.1 dplyr_0.7.4 purrr_0.2.4 readr_1.1.1
[11] tidyr_0.8.0 tibble_1.4.2 ggplot2_2.2.1.9000 tidyverse_1.2.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.16 lattice_0.20-35 assertthat_0.2.0 rprojroot_1.3-2 digest_0.6.15
[6] psych_1.8.4 mime_0.5 R6_2.2.2 cellranger_1.1.0 plyr_1.8.4
[11] backports_1.1.2 evaluate_0.10.1 highr_0.6 httr_1.3.1 pillar_1.2.2
[16] rlang_0.2.0.9001 lazyeval_0.2.1 rstudioapi_0.7 data.table_1.11.2 rmarkdown_1.9
[21] foreign_0.8-70 htmlwidgets_1.2 munsell_0.4.3 shiny_1.0.5 broom_0.4.4
[26] compiler_3.5.0 httpuv_1.4.3 modelr_0.1.2 pkgconfig_2.0.1 base64enc_0.1-3
[31] mnormt_1.5-5 htmltools_0.3.6 viridisLite_0.3.0 crayon_1.3.4 withr_2.1.2
[36] later_0.7.2 grid_3.5.0 nlme_3.1-137 jsonlite_1.5 xtable_1.8-2
[41] gtable_0.2.0 magrittr_1.5 scales_0.5.0.9000 cli_1.0.0 stringi_1.2.2
[46] reshape2_1.4.3 promises_1.0.1 xml2_1.2.0 RColorBrewer_1.1-2 tools_3.5.0
[51] glue_1.2.0 hms_0.4.2 crosstalk_1.0.0 parallel_3.5.0 yaml_2.1.19
[56] colorspace_1.3-2 rvest_0.3.2 bindr_0.1.1 haven_1.1.1
1 Like