New to Plotly?
Plotly's R library is free and open source!
Get started by downloading the client and reading the primer.
You can set up Plotly to work in online or offline mode.
We also have a quick-reference cheatsheet (new!) to help you get started!
##  '22.214.171.12400'
The common image formats: 'PNG', 'JPG/JPEG' are supported. In addition, formats like 'EPS', 'SVG' and 'PDF' are also supported.
Note: The SVG, EPS and PDF Formats are only available for Plotly Professional users. You can get more details on our pricing page.
To access the image in a particular format, you can either:
export()function with the webshot package.
export the image on plotly's servers using
append the format extension to the plot url. i.e. the JPG version of the plot: https://plot.ly/~chris/1638 is available at : https://plot.ly/~chris/1638.jpg.
Recent versions of the R package include an
export() function, which does image export locally, but requires the webshot package:
if (!require("webshot")) install.packages("webshot") tmpFile <- tempfile(fileext = ".png") export(plot_ly(), file = tmpFile) browseURL(tmpFile)
Export Using Your Plotly Account
Another option is to do image export through your plotly account.
First, you will require the development version of plotly, this can be installed using
devtools::install_github("ropensci/plotly"). In addition, if you haven't already, let the R package know about your credentials.
Sys.setenv("plotly_username" = "YOUR USER NAME") Sys.setenv("plotly_api_key" = "YOUR API KEY")
This option will export the image on plotly's servers and write the content to a local file
"output.png" in your working directory.
library(plotly) p <- plot_ly(x = c(1,2,3,4), y = c(2,4,1,3), type = 'scatter', mode = 'lines') plotly_IMAGE(p, format = "png", out_file = "output.png")
Appending File Type to URL
You can also view the static version of any Plotly graph by appending
.svg to the end of the URL. For example, view the static image of https://plot.ly/~chris/1638 at https://plot.ly/~chris/1638.png. See Using Plotly with rmarkdown/knitr for a way to embed these links in rmarkdown/knitr (Rmd) files.