Show Sidebar Hide Sidebar

# Updating Plotly Graphs in R

R Filenames, folders, and updating Plotly graphs in the plotly cloud.

### New to Plotly?

Plotly's R library is free and open source!
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!

### Version Check

Version 4 of Plotly's R package is now available!
Check out this post for more information on breaking changes and new features available in this version.

library(plotly)
packageVersion('plotly')

## [1] '4.7.1'


#### Save Plot to Server

To create a plotly figure on a plotly server, use api_create().

library(plotly)
p <- plot_ly(x = c(1, 2), y = c(1, 2))
api_create(p)


#### Overwrite Plot

If you don't include a filename, a new plot will be made on your online plotly account. If you want to overwrite a plot (i.e., keep the graph served from the same plotly URL), specify a filename. This implicitly overwrites your plotly graph.

api_create(p, filename = "name-of-my-plotly-file")


#### Save your Plot in a Folder

If the filename contains "/", it will automatically create a plotly folder. This option is only available for Pro-Subscriptions

api_create(p, filename="r-docs-name-of-my-plotly-file")


View your Plotly graphs at https://plot.ly/organize.