我使用plotly包来显示闪亮的阴谋。在我的本地机器上,情节完美呈现,但是当我在闪亮的服务器上运行闪亮的应用程序时,我收到错误“错误:无法打开文件'Rplots.pdf'”,情节应该呈现。我已经尝试过使用dev.off()命令,因为我已经阅读了一些其他可能的解决方案,并将其引用为可能的解决方案。下面我贴我的代码创建的server.R脚本图:我使用下面的命令来调用情节Plotly绘制不在闪亮的服务器上呈现
output$recSalesPlot <- renderPlotly({
BWplot_rec <- ggplot(d1, aes_string(x = "End_of_Week", y = input$metric_rec))
BWplot_rec <- BWplot_rec + geom_line(aes(color = Group), size = .25)
BWplot_rec <- BWplot_rec + geom_point(aes(color = Group), size = 2)
BWplot_rec <- BWplot_rec + xlab("Week")
if(input$metric_rec == "NetSales"){
BWplot_rec <- BWplot_rec + ylab("Euros")
}
BWplot_rec <- BWplot_rec + ggtitle(paste0("Average ", input$metric_rec, " Per Group Per Week"))
BWplot_rec <- BWplot_rec + guides(color=FALSE)
BWplot_rec <- BWplot_rec + theme(panel.grid.major.y = element_blank(),
panel.grid.minor.y = element_blank())
p <- ggplotly(BWplot_rec)
p
})
}
在ui.R脚本:
plotlyOutput("recSalesPlot", width = "100%", height = 600)
你有比较本地R的sessionInfo与闪亮的服务器?确保您在闪亮的服务器上拥有所有需要的软件包。 – MLavoie
我还没有这样做,我会这样做,看看是什么情况。我的确读过一个可能的原因是,试图编写一个临时文件,但从服务器访问时没有权限,但它从我的本地执行,这可能是为什么它可以在我的本地服务器而不是服务器上运行。 – mikew