Show Sidebar Hide Sidebar

Sending Data to Charts in R

How to send data to charts in Python. Examples of overwriting charts with new data, extending traces, and adding new traces.

# Learn about API authentication here: https://plot.ly/r/getting-started
# Find your api_key here: https://plot.ly/settings/api

plotly_POST(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.
# Learn about API authentication here: https://plot.ly/r/getting-started
# Find your api_key here: https://plot.ly/settings/api

plotly_POST(plot_ly(x = c(1, 2), y = c(1, 2)), filename="name-of-my-plotly-file", fileopt='extend')
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://plot.ly/r/getting-started
# Find your api_key here: https://plot.ly/settings/api

plotly_POST(plot_ly(x = c(1, 2), y = c(1, 2)), filename="name-of-my-plotly-file", fileopt='append')
NOT RECOMMENDED
When updating a chart's data remotely, we recommend overwriting all of the chart's data instead of adding new traces.
Still need help?
Contact Us

For guaranteed 24 hour response turnarounds, upgrade to a Developer Support Plan.