我正在尝试在Shiny UI中呈现的本地文件夹中有静态图像,但它不起作用。显示中间有问号的损坏图像。
ui <- fluidPage(img(src = 'imagefile.png', height = '100px', width = '100px'))
server <- function(input, output) {}
shinyApp(ui = ui, server = server)
知道发生了什么吗?
最佳答案
将图像放在同一目录中的www文件夹中,因此您具有www/imagefile.png。然后打电话
library(shiny)
ui <- fluidPage(img(src = 'imagefile.png', height = '100px', width = '100px'))
server <- function(input, output) {}
shinyAppDir(".")
但是,您可能希望将
runApp
与单独的ui和服务器文件一起使用。
关于UI侧的R Shiny img()无法渲染图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35760656/