Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image doesn't display RShiny [duplicate]

Tags:

r

shiny

I am having trouble displaying an image in a Shiny app. The code is saved in Desktop, where I also have a www folder with logo.png. I've set the working directory to the desktop, as well:

library(shiny)
library(png)

ui <- fluidPage(
  img(src="logo.png", height = 400, width = 400)
) #close fluidpage


server <- function(input, output, session){

} # closer server

shinyApp(ui=ui, server=server)

Here's how the output looks.
enter image description here

I prefer to have server and ui in the same file for ease of understanding. Perhaps that is the issue?

like image 782
matsuo_basho Avatar asked Apr 24 '16 00:04

matsuo_basho


People also ask

Why is the image not showing for R shiny?

It's just the image-display that is faulty. By default, RStudio searches in the 'www' folder. Try creating such a folder and place your image file in there. Make sure you still use the same path without 'www' for the src .

How do you put a picture in a shiny dashboard in R?

Adding Image To add an image in Shiny is done by using renderImage() function.


1 Answers

Similar Shiny img problem solved here. Rather than executing the code directly or in console, creating a properly formatted app.R and clicking Run App seems to work.

like image 196
deduciver Avatar answered Oct 01 '22 19:10

deduciver