Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 可下载的Plot Shining模块不显示在Shining应用程序中_R_Shiny_Downloadableplot - Fatal编程技术网

R 可下载的Plot Shining模块不显示在Shining应用程序中

R 可下载的Plot Shining模块不显示在Shining应用程序中,r,shiny,downloadableplot,R,Shiny,Downloadableplot,我有下面的shinny应用程序,我想知道如何使用downloadablePlotshinny模块下载绘图。启动应用程序时,visibleplot中出现错误:找不到函数“visibleplot”。它应该通过shinny包加载,按钮不显示 library(shiny) library(periscope) ui <- fluidPage( plotOutput("plot"), downloadablePlotUI("object_id1",

我有下面的
shinny
应用程序,我想知道如何使用
downloadablePlot
shinny模块下载绘图。启动应用程序时,visibleplot中出现
错误:找不到函数“visibleplot”
。它应该通过
shinny
包加载,按钮不显示

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)
库(闪亮)
图书馆(潜望镜)

ui关于
可下载绘图ui
的文档说明如下:

此模块与内置(基本)图形(图形包提供的任何功能,如plot)不兼容,因为它们无法保存到对象中,并且在创建时由系统直接输出

您正在使用无法显示的绘图(iris)

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)
使用
ggplot
将显示绘图。我仍然没有得到下载按钮

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 )
  
}

服务器谢谢,那我怎么用呢?