How to place an image in the R Shiny header

So, I'm using R Shiny, and I want to put the image to the right of the text in the header. It seems I put the image anywhere in the application, except next to the title bar. Can you put the images in a function titlePanel()? Here is the code snippet I'm using:

library(shiny)

# Define UI for random distribution application 
shinyUI(fluidPage(#theme="bootstrap.css",

  # Application title
  titlePanel("My Title",img(src = "picture.jpg", height = 50, width = 100)),
  sidebarLayout(
    sidebarPanel(

Therefore, when I use the code above, I can not see my image anywhere in the application.

+4
source share
1 answer

One way is to follow the directions in this post: How can I insert an image into the navigation bar on shiny navbarPage () (SO attacks will attack this as a duplicate).

"www" "picture.jpg" :

| shinyApp/
    | ui.R
    | server.R
 | www/
    | picture.png

titlePanel div:

ui.r

library(shiny)

# Define UI for random distribution application 
shinyUI(fluidPage(#theme="bootstrap.css",

  # Application title
  titlePanel(title=div(img(src="picture.jpg"), "My Title")),
  sidebarLayout(
    sidebarPanel(
    )
  )
)
)

enter image description here

+8

All Articles