我已经在R中用plotly()创建了一个交互式绘图图表,我想将它保存为一个文件。
我可以接受任何格式,无论是js、html还是其他格式。我想保持交互性。
这是我的代码
gg <-
iris %>%
ggplot(aes(Species, Sepal.length)) +
geom_col(fill = "green")
ggplotly(gg)
我在this answer上读到,你可以在Plotly的Python实现中使用plotly.offline.plot(data, filename='file.html')
。我的目标是使用“上传文件”功能将绘图图表上传到概念文档。
发布于 2020-10-12 22:01:35
您可以尝试使用htmlwidgets
包中的saveWidget()
:
library(plotly)
library(tidyverse)
library(htmlwidgets)
#Plot
gg <-
iris %>%
ggplot(aes(Species, Sepal.Length)) +
geom_col(fill = "green")
#Export
saveWidget(ggplotly(gg), file = "myplot.html")
https://stackoverflow.com/questions/64319323
复制相似问题