|
1 | 1 | #' Export a plotly graph to a static file |
2 | 2 | #' |
3 | | -#' This function is in the process of being deprecated. Use the `[orca]()` function instead. |
| 3 | +#' This function is in the process of being deprecated (use [orca] instead). |
4 | 4 | #' |
5 | 5 | #' @details For SVG plots, a screenshot is taken via `webshot::webshot()`. |
6 | 6 | #' Since `phantomjs` (and hence `webshot`) does not support WebGL, |
|
11 | 11 | #' Valid extensions include 'jpeg' | 'png' | 'webp' | 'svg' | 'pdf' |
12 | 12 | #' @param selenium used only when `p` is a WebGL plot or the output |
13 | 13 | #' format is 'webp' or 'svg'. Should be an object of class "rsClientServer" |
14 | | -#' returned by `RSelenium::rsDriver` (see examples). |
| 14 | +#' returned by `RSelenium::rsDriver`. |
15 | 15 | #' @param ... if `p` is non-WebGL and the output file format is |
16 | 16 | #' jpeg/png/pdf arguments are passed along to `webshot::webshot()`. |
17 | 17 | #' Otherwise, they are ignored. |
18 | 18 | #' @export |
19 | 19 | #' @author Carson Sievert |
20 | | -#' @examples |
21 | | -#' # The webshot package handles non-WebGL conversion to jpeg/png/pdf |
22 | | -#' \dontrun{ |
23 | | -#' export(plot_ly(economics, x = ~date, y = ~pce)) |
24 | | -#' export(plot_ly(economics, x = ~date, y = ~pce), "plot.pdf") |
25 | | -#' |
26 | | -#' # If you can't get a selenium server running, another option is to |
27 | | -#' # use Plotly.downloadImage() via htmlwidgets::onRender()... |
28 | | -#' # Downloading images won't work inside RStudio, but you can set the viewer |
29 | | -#' # option to NULL to prompt your default web browser |
30 | | -#' options(viewer = NULL) |
31 | | -#' plot_ly(economics, x = ~date, y = ~pce, z = ~pop) %>% |
32 | | -#' htmlwidgets::onRender( |
33 | | -#' "function(el, x) { |
34 | | -#' var gd = document.getElementById(el.id); |
35 | | -#' Plotly.downloadImage(gd, {format: 'png', width: 600, height: 400, filename: 'plot'}); |
36 | | -#' }" |
37 | | -#' ) |
38 | | -#'} |
| 20 | +#' |
39 | 21 | export <- function(p = last_plot(), file = "plotly.png", selenium = NULL, ...) { |
40 | | - message( |
41 | | - "The `export()` function is in the process of being deprecated. ", |
42 | | - "Please use the `orca()` function instead." |
43 | | - ) |
| 22 | + .Deprecated("orca") |
44 | 23 |
|
45 | 24 | # infer the file type |
46 | 25 | fileType <- tolower(tools::file_ext(file)) |
|
0 commit comments