2014-03-04 119 views
0

我想顯示由R在Shiny上產生的圖形圖像。我的輸出圖像在App-1 \ www中。R輸出圖像列表的閃亮下拉列表

使用mainpanel,我可以逐個顯示圖像。是否有可能使用下拉並從閃亮的圖像調用?

有什麼建議嗎?

問候, 拉吉

回答

0

這感覺就像一個黑客攻擊我,但它的工作原理。我也想知道這是否會工作使用:

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

而且道歉這裏的格式....

ui.R

庫(閃亮)

定義UI

shinyUI(fluidPage(

#應用標題 titlePanel(以下簡稱 「實施例」),

#邊欄與倉 sidebarLayout( sidebarPanel( selectInput( 「階段」 的數目的滑塊輸入, 「示例文本:」, 選擇= C(「階段1 」, 「2」, 「3」)) )

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

) ))

server.R

庫(JPEG)

定義服務器邏輯

shinyServer(功能(輸入,輸出){

輸出$ distPlot < - renderPlot({

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) 

}) })