I use the plotly package to display a graph in brilliant state. On my local machine, the plot is fine, but when I run the brilliant application on a brilliant server, I get the error message "Error: I can not open the file" Rplots.pdf ", where it is assumed that the plot will be displayed. I tried to use the dev command. off (), as I read some other possible solutions that referred to this as a possible solution, below I inserted my code to create a graph on the server. R script:
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
})
}
In the ui.R script, I use the following command to invoke the graph:
plotlyOutput("recSalesPlot", width = "100%", height = 600)
mikew source
share