Search code examples
shinyexpressionsymbols

Why are Greek letters not displayed in the R-Shiny plot title with the 'expression' command?


Greek letters not displayed in R-Shiny using the command expression

The following R-code works locally and the alpha is properly displayed in the title of the plot:

require(shiny)
ui <- fluidPage(mainPanel(plotOutput(outputId="Plot")))
server <- function(input, output, session){
output$Plot <- renderPlot({plot(0, 0, main=expression(alpha))})
# }
shinyApp(ui=ui, server=server)

But on the shiny-server there appears no alpha at all. I do not use ggplot only base-R.

Any ideas?


Solution

  • It works using the unicodes for the greek leters, in case of \alpha = \u03b1

    require(shiny)
    ui <- fluidPage(mainPanel(plotOutput(outputId="Plot")))
    server <- function(input, output, session){
    output$Plot <- renderPlot({plot(0, 0, main="\u03b1")})
    }
    shinyApp(ui=ui, server=server)