Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

italic font in titlePanel within the shiny app

Tags:

r

shiny

Is there a way to get italic words in my shiny titlePanel?

I tried

library(shiny)

# Define UI for application that draws a histogram
ui <- shinyUI(fluidPage(

   # Application title
   titlePanel("Old <em>Faithful Geyser</em> Data"),

   # Sidebar with a slider input for number of bins
   sidebarLayout(
      sidebarPanel(
         sliderInput("bins",
                     "Number of bins:",
                     min = 1,
                     max = 50,
                     value = 30)
      ),

      # Show a plot of the generated distribution
      mainPanel(
         plotOutput("distPlot")
      )
   )
))

# Define server logic required to draw a histogram
server <- shinyServer(function(input, output) {

   output$distPlot <- renderPlot({
      # generate bins based on input$bins from ui.R
      x    <- faithful[, 2]
      bins <- seq(min(x), max(x), length.out = input$bins + 1)

      # draw the histogram with the specified number of bins
      hist(x, breaks = bins, col = 'darkgray', border = 'white')
   })
})

# Run the application
shinyApp(ui = ui, server = server)

and this print the title as Old <em>Faithful Geyser</em> Data. The em does not get interpreted. Am I doing something wrong or isn't there a way to get italic font in the title?

like image 794
drmariod Avatar asked Jan 06 '23 19:01

drmariod


1 Answers

hello try this it should work

titlePanel( div(HTML("Old <em>Faithful Geyser</em> Data")))
like image 169
s.brunel Avatar answered Jan 16 '23 19:01

s.brunel