英文:
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
以下R代码在本地正常工作,标题中的alpha正常显示:
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)
但在shiny服务器上,根本没有显示alpha。我不使用ggplot,只使用base-R。
有任何想法?
英文:
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?
答案1
得分: 1
它使用希腊字母的Unicode工作,例如 \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)
英文:
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)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论