Sending Data to Chart Studio Graphs in R
How to send data to charts in Python. Examples of overwriting charts with new data, extending traces, and adding new traces.
Plotly Studio: Transform any dataset into an interactive data application in minutes with AI. Sign up for early access now.
# Learn about API authentication here: https://plotly.com/r/getting-started
# Find your api_key here: https://plotly.com/settings/api
api_create(plot_ly(x = c(1, 2), y = c(1, 2)), filename='overwrite example')
The simplest and recommended way to update a chart remotely.
You can overwrite a chart's data with new data remotely, simply by including its file name in the filename kwarg.
Note that setting a filename overwrites the entire chart (i.e., style & layout settings are not preserved).

# Learn about API authentication here: https://plotly.com/r/getting-started
# Find your api_key here: https://plotly.com/settings/api
api_create(plot_ly(x = c(1, 2), y = c(1, 2)), filename="name-of-my-plotly-file", <b>fileopt='extend'</b>)
Add data to an existing trace by settingfileopt='extend'
.
This method is used for embedded systems that may not have the memory for a full overwrite of the chart data in one API call.

# Learn about API authentication here: https://plotly.com/r/getting-started
# Find your api_key here: https://plotly.com/settings/api
api_create(plot_ly(x = c(1, 2), y = c(1, 2)), filename="name-of-my-plotly-file", <b>fileopt='append'</b>)
NOT RECOMMENDED
When updating a chart's data remotely, we recommend overwriting all of the chart's data instead of adding new traces.
