2016-06-30 2 views
2

Есть ли способ получить курсивом слова в моем shinytitlePanel?курсивный шрифт в заголовкеPanel в блестящем приложении

Я попытался

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) 

и этот принт название как Old <em>Faithful Geyser</em> Data. Значение em не интерпретируется. Я делаю что-то неправильно или нет способа получить курсивный шрифт в названии?

ответ

4

привет попробовать это, он должен работать

titlePanel(div(HTML("Old <em>Faithful Geyser</em> Data"))) 
+1

Спасибо, не нужно 'div', но' HTML' сделал трюк! – drmariod

+0

Вы можете просто использовать 'p (strong (" жирный шрифт "), em (" italic font ")),' как ссылается на https://bookdown.org/weicheng/shinyTutorial/ui.html. Это работает. –

+0

Не могли бы вы использовать аналогичный метод для изменения цвета шрифта? – Heliornis