首页 > 大数据 > 可视化 > R 如何把ployly生成的图表保存成html
You can save a plot as standalone HTML with htmlwidgets::saveWidget(), but for reasons discussed here, plotly objects are not htmlwidget objects, so you'll have to convert the plotly object to an htmlwidget object with as.widget(), for example.
library(plotly) p <- plot_ly(mtcars, x = mpg, y = disp, mode = "markers") htmlwidgets::saveWidget(as.widget(p), "index.html")
Another option is to use Export -> Save as Web Page in the RStudio viewer
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30066956/viewspace-2059589/ ,如需转载,请注明出处,否则将追究法律责任。