Komal Rathi Komal Rathi - 3 months ago 45
R Question

R: Plotly package error in downloading png

I am using the plotly package to create plots in my shiny app but I am having trouble downloading these plots. Because this is for a shiny app, I want it to be interactive and not hardcoded.

Code:

library(plotly)
dat <- data.frame(x = rnorm(1:100), y = rnorm(1:100))
p <- ggplot(dat, aes(x = x, y = y)) + geom_point()
plotly_build(p)


sessionInfo:

R version 3.3.0 (2016-05-03)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.5 (El Capitan)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] plotly_3.6.0 ggplot2_2.1.0 BiocInstaller_1.23.6

loaded via a namespace (and not attached):
[1] Rcpp_0.12.6 tidyr_0.5.1 assertthat_0.1 digest_0.6.9 grid_3.3.0 plyr_1.8.4 R6_2.1.2 jsonlite_1.0
[9] gtable_0.2.0 magrittr_1.5 scales_0.4.0 httr_1.2.1 viridis_0.3.4 labeling_0.3 tools_3.3.0 htmlwidgets_0.6
[17] munsell_0.4.3 yaml_2.1.13 rsconnect_0.4.3 base64enc_0.1-3 colorspace_1.2-6 htmltools_0.3.5 gridExtra_2.2.1 tibble_1.1


I am having trouble downloading the plot. When I click on the camera on the top right toolbar in the plotly graph, it gives me the following error:

enter image description here

I am having this problem in the Rstudio Viewer pane, Safari and Chrome. How can I circumvent this problem and download the plot?

Pj_ Pj_
Answer

Updating your plotly package should do the trick. http://community.plot.ly/t/download-png-not-working-in-r-shiny/1574/3

Comments