-
Notifications
You must be signed in to change notification settings - Fork 37
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
Webshot cuts off images with plotly widgets #73
Comments
I have same issue! (with same version of packages plotly_4.8.0 webshot_0.5.1) Similar reproducible example as above
R version 3.4.2 (2017-09-28) Matrix products: default locale: attached base packages: other attached packages: loaded via a namespace (and not attached): |
It appears https://github.com/rstudio/webshot2 doesn't suffer from this issue...consider using |
I am trying to include static images of plotly widgets in my rmarkdown reports. I like the interactively of plotly so I save the widgets locally, but they take up too much space when knitting. I have been able to do this by two ways. Either in the code chunk using the option screenshot.force=TRUE (uses webshot) or saving the widget locally with saveWidget() and then using the webshot() function. The issue is that the image is cut off at the lower portion of the y-axis, which is bothersome. I would expect the whole image to be saved with webshot. I have tried adjusting the features of vwidth, vheight, and cliprect with no luck. Though this seems to work properly with other widgets like leaflet.
To reproduce make any simple plot_ly plot, save the widget with saveWidget, then save a png with webshot.
Example script:
require(webshot)
require(plotly)
require(htmlwidgets)
data("iris")
simple_plot=plot_ly(x=iris$Petal.Width,y=iris$Petal.Length,type="scatter",mode="markers")
saveWidget(widget = simple_plot,file = "simple_plot.html")
webshot(url = "simple_plot.html",file = "webshot_iris.png")
To see this I am attaching image from webshot (second image) and a manual screenshot from savewidget (first image). Notice that the webshot version is cut off with the lower numbers on the y-axis
Session info:
R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] htmlwidgets_1.2 bindrcpp_0.2.2 plotly_4.8.0 ggplot2_3.0.0 webshot_0.5.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.18 later_0.7.3 pillar_1.3.0 compiler_3.5.2 plyr_1.8.4 bindr_0.1.1
[7] tools_3.5.2 digest_0.6.15 jsonlite_1.5 tibble_1.4.2 gtable_0.2.0 viridisLite_0.3.0
[13] pkgconfig_2.0.1 rlang_0.2.1 shiny_1.1.0 rstudioapi_0.7 crosstalk_1.0.0 yaml_2.2.0
[19] withr_2.1.2 dplyr_0.7.6 httr_1.3.1 grid_3.5.2 tidyselect_0.2.4 glue_1.3.0
[25] data.table_1.11.4 R6_2.2.2 processx_3.1.0 callr_2.0.4 purrr_0.2.5 tidyr_0.8.1
[31] magrittr_1.5 promises_1.0.1 scales_0.5.0 htmltools_0.3.6 assertthat_0.2.0 xtable_1.8-2
[37] mime_0.5 colorspace_1.3-2 httpuv_1.4.5 lazyeval_0.2.1 munsell_0.5.0 crayon_1.3.4
The text was updated successfully, but these errors were encountered: