首先,我是 Shiny 的初學者。我正在嘗試將我在我的應用程式中使用lattice包制作的繪圖(使用按鈕)保存在本地。但是,我無法在服務器中創建相應的功能。
請幫忙
下載按鈕并在我的 UI 中繪圖:
downloadButton('downloadPlot2', 'Save lattice plot locally')
.
.
.
tabPanel(names(panel_choices)[2], value = panel_choices[[2]], plotOutput("plot2"))
服務器:
output$plot2 <- renderPlot({
print(plotInput2())
})
plotInput2 <- reactive({
md <- mydata()
md.long <- melt(md, id = "ID", measure = colnames(md)[-1])
xyplot(value~md.long[,1],data = md.long,main="visualization of data from csv file",ylim = c(input$value[1],input$value[2]),
xlab = "ID",ylab = "values of variables")
})
uj5u.com熱心網友回復:
您可以使用 執行此操作downloadHandler,只需將其粘貼到您的服務器中:
output$downloadPlot2 <- downloadHandler(
filename = '',
content = function(file) {
png(file)
print(plotInput2())
dev.off()
})
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/523541.html
標籤:r图片闪亮的下载格子
上一篇:React中的onLoad事件沒有像我預期的那樣表現
下一篇:在Java中合并影像
