Show Sidebar Hide Sidebar

Public vs Private Graphs in R

How to set the privacy settings of plotly graphs in R.

New to Plotly?

Plotly's R library is free and open source!
Get started by downloading the client and reading the primer.
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.0'

Default Privacy

Plotly for R renders entirely locally by default, but you can also publish these graphs to the web via the api_create() function. By default, api_create() creates public graphs (which are free to create), but with a plotly subscription you can easily make them private via the sharing argument.

Public Graph

Please note, this is the default privacy option.

library(plotly)
p <- plot_ly(x = c(0, 2, 4), y = c(0, 4, 2), type = 'scatter', mode = 'markers+lines')
chart_link = api_create(p, filename = "public-graph")
chart_link

Below is the URL of this public plot. Anyone can view public plots even if they are not logged into Plotly.
Try it out: https://plot.ly/~RPlotBot/4545

Private Graph

library(plotly)
p <- plot_ly(x = c(0, 2, 4), y = c(0, 4, 2), type = 'scatter', mode = 'markers+lines')
chart_link = api_create(p, filename = "private-graph", sharing = "private")
chart_link

Below is the URL of the private plot above. Only the owner can view the private plot. You won't be able to view this plot.
Try it out: https://plot.ly/~RPlotBot/4549/

Secret Graph

library(plotly)
p <- plot_ly(x = c(0, 2, 4), y = c(0, 4, 2), type = 'scatter', mode = 'markers+lines')
chart_link = api_create(p, filename = "secret-graph", sharing = "secret")
chart_link

Below is the URL of this secret plot. Anyone with the secret link can view this chart. However, it will not appear in the Plotly feed, your profile, or search engines.
Try it out: https://plot.ly/~RPlotBot/4553/?share_key=62AMQ8YBpZebu6Y5OYsukj

Still need help?
Contact Us

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