【问题标题】:Shiny dropdown for list of R ouput imagesR输出图像列表的闪亮下拉列表
【发布时间】:2014-04-05 21:46:21
【问题描述】:

我正在尝试在 Shiny 上显示 R 生成的绘图图像。我的输出图像在 App-1\www.

使用主面板,我可以一张一张地显示图像。是否可以使用下拉菜单并从闪亮中调用图像?

有什么建议吗?

问候, 拉杰

【问题讨论】:

    标签: r analytics shiny shiny-server


    【解决方案1】:

    这对我来说就像是一个 hack,但它确实有效。我也想知道这是否可以使用:

    mainPanel(
      img(src="nestler_test.jpg", height = 700, width = 00)
    )
    

    也为这里的格式道歉....

    ui.R

    图书馆(闪亮)

    定义用户界面

    shinyUI(fluidPage(

    # 应用程序标题 titlePanel("示例"),

    # 带有滑动条输入箱数的侧边栏 侧边栏布局( 侧边栏面板( selectInput("stage", "示例文本:", 选择 = c("stage1", "2", "3")) ),

    # Show a plot of the generated distribution
    mainPanel(
      plotOutput("distPlot")
    )
    

    ) ))

    服务器.R

    图书馆(jpeg)

    定义服务器逻辑

    shinyServer(函数(输入,输出){

    输出$distPlot

    if (input$stage=="stage1") {
      img=readJPEG('1st_test.jpg')
    } else if (input$stage=='2') {
      img=readJPEG('2nd_test.jpg')
    }
    plot(c(100, 250), c(300, 550), type='n', ylab='',xlab='', xaxt='n', yaxt='n', frame.plot=F)
    rasterImage(img, 100, 300, 250, 550)
    

    }) })

    【讨论】:

      猜你喜欢
      • 2015-08-03
      • 2016-01-11
      • 1970-01-01
      • 2013-12-21
      • 1970-01-01
      • 2019-12-04
      • 1970-01-01
      • 1970-01-01
      • 2019-12-23
      相关资源
      最近更新 更多