【发布时间】:2016-10-06 10:34:23
【问题描述】:
我正在尝试将 ggplot 对象转换为 plotly 并在闪亮的应用程序中显示它。但是我遇到了一个错误“没有适用于 'plotly_build' 的方法应用于类“NULL”的对象”
我能够成功地将 ggplot 对象返回到闪亮的应用程序,
output$plot1 <- renderplot({
gp <- ggplot(data = mtcars, aes(x = disp, y = cyl)) + geom_smooth(method = lm, formula = y~x) + geom_point() + theme_gdocs()
})
但不知何故无法转换它。
我的代码是这样的
output$plot2 <- renderplotly({
gp <- ggplot(data = mtcars, aes(x = disp, y = cyl)) + geom_smooth(method = lm, formula = y~x) + geom_point() + theme_gdocs()
ggplotly()
})
【问题讨论】:
-
改用 renderPlotly