Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embedding Image in Shiny App

Tags:

r

embed

shiny

I've been working on a shiny app and would like to include a logo in the upper right corner of the app. How can I easily embed an image using shiny and r?

Thanks! K

like image 669
kay Avatar asked Feb 24 '14 19:02

kay


People also ask

Can you embed a Shiny app on website?

Yes! A shiny app can be put in an iframe in another website from RStudio Connect. In order to put the app in an iframe, it is recommended to add a content URL, because you can move it to another piece of content should the need arise.

How do I add a Shiny logo in R?

titlePanel allows to add easily images to the application title, by using: titlePanel(title = div(img(src="myAppImage. jpg"), "My App Name") It is also possible to add the title that should be displayed by the browser window with windowTitle as a parameter.

How do you structure a Shiny app?

A Shiny app consists of two parts, a user interface ( ui ) and an R session that runs code and returns results ( server ). These two parts can be in their own files called ui. R and server.


1 Answers

I found another option that looks good for this app, so I'm sharing for others who want the image in the mainPanel.

mainPanel(    img(src='myImage.png', align = "right"),   ### the rest of your code   ) 

Save the file in a www directory in the shinyApp directory:

 | shinyApp/     | ui.R     | server.R     | www/        | myImage.png 
like image 111
kay Avatar answered Oct 03 '22 05:10

kay