Ggplotly html filename

Is there a way to tell plotly a name to save the html output when using ggplotly?

Example, if a run ggplotly( ggplot(data=mtcars) + geom_point(aes(x=drat, y=hp, color=factor(carb))) )
i will get a new tab in my browser with a (temporary) html file like this: “file:///tmp/RtmpPwthyX/viewhtml20cb49cc9841/index.html”

I would like to define a human readable name, is it possible?

Thank you.

I would recommend using htmlwidgets::saveWidget to accomplish this. For the current CRAN release, you can do:

library(plotly)
ggp <- ggplotly( ggplot(data=mtcars) + geom_point(aes(x=drat, y=hp, color=factor(carb))) )
htmlwidgets::saveWidget(as.widget(ggp), "index.html")

With the new major release currently in fix/nse branch, you can do

# devtools::install_github("ropensci/plotly@fix/nse")
library(plotly)
ggp <- ggplotly( ggplot(data=mtcars) + geom_point(aes(x=drat, y=hp, color=factor(carb))) )
htmlwidgets::saveWidget(ggp, "index.html")

Just so you know htmlwidgets::saveWidget works with all htmlwidgets so it can be very helpful.

Thanks, it works for me.