如何获取ggplotly绘图的HTML代码

如何获取ggplotly绘图的HTML代码,html,r,ggplot2,plotly,Html,R,Ggplot2,Plotly,下面的代码构建了一个交互式绘图,我想将其集成到我的wordpress文章中: # interactive plot with ribbon test <- ggplot(data = wide.data, aes(x = x, y = pred)) + geom_ribbon(aes(ymin = lwr, ymax = upr, fill = model), alpha = .5) + geom_point(aes( group = model, fill = model))

下面的代码构建了一个交互式绘图,我想将其集成到我的wordpress文章中:

# interactive plot with ribbon
test <- ggplot(data = wide.data, aes(x = x, y = pred)) +
  geom_ribbon(aes(ymin = lwr, ymax = upr, fill = model), alpha = .5) + 
  geom_point(aes( group = model, fill = model)) + 
  labs(x = "Number of Games Played", y = "Total Number of Goals") + scale_y_continuous(breaks=seq(0,70,5)) +
  scale_x_continuous(breaks=seq(0,50,5))

ggplotly(test)
#带功能区的交互式绘图

测试如果您在浏览器中打开绘图,您可以右键单击>查看页面源代码(或检查元素,取决于您喜欢的内容)或者类似的内容是您想要的?或者可能会有帮助?是-或者您也可以将
源代码(yourRfile.R)
放在代码块中。然后,在区块外放上任何你想要的文本(通常是解释区块内的内容)。@symbolxau;你能发布一个答案吗?一组不连贯的评论会更有用。