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 )
}
服务器谢谢,那我怎么用呢?