Configuration Options For Embedded Chart Studio Graphs in ggplot2

How to set configuration options of embedded Chart Studio graphs in ggplot2. Examples of both online and offline configurations.

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.

Online Configuration Options

Configuration options for graphs created with the plotly ggplot2 package are overridden when those graphs are published to Chart Studio using the api_create() function.

To set configutation options for charts published to Chart STudio, you can edit the plot's embed url.

Visit our embed tutorial for more information on customizing the embed URL to remove the "Edit Chart" link, hide the modebar, or autosize the plot.

Offline Configuration Options

Add the 'Edit Chart' link:

p <- plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length)

htmlwidgets::saveWidget(config(p, showLink = T), "graph.html")

Remove the 'mode bar':

htmlwidgets::saveWidget(config(p, displayModeBar = FALSE), "graph.html")


Arguments are documented here.

What About Dash?

Dash for R is an open-source framework for building analytical applications, with no Javascript required, and it is tightly integrated with the Plotly graphing library.

Learn about how to install Dash for R at

Everywhere in this page that you see fig, you can display the same figure in a Dash for R application by passing it to the figure argument of the Graph component from the built-in dashCoreComponents package like this:


fig <- plot_ly() 
# fig <- fig %>% add_trace( ... )
# fig <- fig %>% layout( ... ) 


app <- Dash$new()

app$run_server(debug=TRUE, dev_tools_hot_reload=FALSE)