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 is known for its graphing libraries, but it's also a broader ecosystem for building interactive data apps, AI data analysis tools, and deploying and hosting Dash apps. Explore the full set of tools and platforms designed to help turn data into action. Discover Plotly.

Note: We are retiring documentation for R, MATLAB, Julia, and F#. Learn more about this change here.

# 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.