plotly (version 3.6.0)

plotly_build: Create a 'plotly_built' object

Description

This generic function creates the list object sent to plotly.js for rendering. Using this function can be useful for overriding defaults provided by ggplotly/plot_ly or for debugging rendering errors.

Usage

plotly_build(l = last_plot())

Arguments

l

a ggplot object, or a plotly_hash object, or a list.

Examples

Run this code
# NOT RUN {
p <- plot_ly()
# data frame
str(p)
# the actual list of options sent to plotly.js
str(plotly_build(p))

p <- qplot(data = mtcars, wt, mpg, geom = c("point", "smooth"))
l <- plotly_build(p)
# turn off hoverinfo for the smooth (but keep it for the points)
l$data[[2]]$hoverinfo <- "none"
l$data[[3]]$hoverinfo <- "none"
l

# }

Run the code above in your browser using DataLab