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.


New to Plotly?

Plotly is a free and open-source graphing library for R. We recommend you read our Getting Started guide for the latest installation or upgrade instructions, then move on to our Plotly Fundamentals tutorials or dive straight in to some Basic Charts tutorials.

# 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 setting fileopt='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.