R 如何把ployly生成的圖表儲存成html

self_control發表於2016-03-18
來源 :https://github.com/ropensci/plotly/issues/294

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部落格 ” ,連結:http://blog.itpub.net/30066956/viewspace-2059589/,如需轉載,請註明出處,否則將追究法律責任。

相關文章