Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
623 views
in Technique[技术] by (71.8m points)

Image not showing in Shiny app R

I have an image i'd like to embed into my shiny app, and have read as much as I can find on how to do it. Although, all I get is a blue question mark when I run my code.

This is the line of code I have added, within the fluidPage ui command

img(src="logo.png", align = "right",height='100px',width='400px')

My image has been placed in the project directory folder, as well as trying in a separate folder inside named www (as per suggestion given here)

EDIT: Code used in the following context:

ui <- fluidPage(titlePanel("Test title"),

                img(src="logo.png", align = "right",height='100px',width='400px'),

                hr())
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

After coming back to this problem, I found that the solution is to simply format the Shiny code properly, by naming the R file app.R, and clicking Run App as opposed to selecting all of the code and running within the console.

Not sure how or why this makes a difference, but the numerous Shiny applications I have worked on since have all been resolved when doing this.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...