![](/img/trans.png)
[英]The downloadablePlot Shiny Module breaks down my shiny app upon launching
[英]The downloadablePlot shiny module is not displayed in a shiny app
我有下面的shiny
應用程序,我想知道如何使用可下載的 Plot Shiny 模塊downloadablePlot
plot。 當我啟動應用程序時Error in visibleplot: could not find function "visibleplot"
。 它應該通過shiny
package 加載,並且按鈕不顯示。
library(shiny)
library(periscope)
ui <- fluidPage(
plotOutput("plot"),
downloadablePlotUI("object_id1",
downloadtypes = c("png", "csv"),
download_hovertext = "Download the plot and data here!",
height = "500px",
btn_halign = "left")
)
server <- function(input, output) {
output$plot<-renderPlot(plot(iris))
plotInput = function() {
plot(iris)
}
callModule(downloadablePlot,
"object_id1",
logger = ss_userAction.Log,
filenameroot = "mydownload1",
aspectratio = 1.33,
downloadfxns = list(png = plotInput),
visibleplot = plotInput)
}
shinyApp(ui = ui, server = server)
downloadablePlotUI
上的文檔說明如下:
該模塊與內置(基礎)圖形(圖形package提供的任何功能,例如繪圖)不兼容,因為它們無法保存到object中,並且在系統創建時直接為Z78E6221F6393D1356681DB398F14CE6。
您正在使用無法顯示的 plot(iris)。
使用ggplot
將顯示 plot。 我仍然沒有得到下載按鈕。
server <- function(input, output, session) {
output$plot<-renderPlot(plotInput())
plotInput <- function() {
ggplot(cars, aes(x=speed, y=dist))+geom_point()
}
plot <- ggplot(cars, aes(x=speed, y=dist))+geom_point()
callModule(downloadablePlot,
"object_id1",
logger = ss_userAction.Log,
filenameroot = "mydownload1",
aspectratio = 1.33,
downloadfxns = list(png = plotInput),
visibleplot = plotInput )
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.