图像无法以R闪亮显示 [英] Image failing to display in R shiny

查看:55
本文介绍了图像无法以R闪亮显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得确实有一个愚蠢的错误,但是我自己解决不了,这使我发疯.简而言之,Rshiny不会显示图像.

I feel like there is really silly mistake, but I can't solve this myself and it is driving me crazy. To simply put, Rshiny is not display the image.

我将源图像放在Rscript文件所在路径的www目录中,但是出了点问题.

I put the source image in www directory in same path as the Rscript file, yet something is wrong.

我使用的代码如下:

ui <- fluidPage(
  fluidRow(
    titlePanel(title=div(img(height = 100,
                             width = 100,
                             src = "dummy-logo.png"), "dummy")),
    sidebarLayout(...

这是我拍摄图片的途径.

This is the pathway for my image.

这是目录.

但是Rshiny找不到图像:

Yet Rshiny could not find the image:

我环顾了其他职位,但仍然不确定哪里出了问题.我敢肯定,这是一个我会感到羞耻的愚蠢错误,但是到目前为止,它使我发疯.谢谢.

I looked around other posts but I am still not sure where I went wrong. I am pretty sure this is some really dumb mistake that I will be ashamed of but as of now, it is driving me nuts. Thank you.

推荐答案

您检查了此答案吗?在闪亮的应用程序中嵌入图像

也许将titlePanel重写为:

Maybe rewrite the titlePanel to:

titlePanel(title=div(id="dummy", img(height = 100,
                         width = 100,
                         src = "dummy-logo.png"))),

然后检查图像是否真正命名为- dummy-logo.png .

And check if the image is really named - dummy-logo.png.

否则,我建议您在RStudio-> New Directory-> Shiny Web Application中创建一个新项目.将您的ui和服务器功能放在那里.创建www文件夹,将图像放在其中,它应该可以正常工作.

Otherwise i would suggest you create a New Project in RStudio -> New Directory -> Shiny Web Application. Put your ui and server functions in there. Create the www-folder, put your image in there and it should work like that.

这篇关于图像无法以R闪亮显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆