So I am using R Shiny and I want to place an image to the right of the text in the title. I can seem to place the image anywhere in the application with the exception of next to the title. Can you not place images in the titlePanel()
function? Here is a snippet of the code that I am 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(
So when I use the above code I can't seem to see my image anywhere in the app....
One way would be to follow the directions in this post: How can I insert an image into the navbar on a shiny navbarPage() (The SO hounds would attack this as a duplicate).
Create a folder called 'www' in your working directory and place 'picture.jpg' inside as so:
| shinyApp/
| ui.R
| server.R
| www/
| picture.png
Include your picture in titlePanel with a 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(
)
)
)
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With