shiny 服务器未响应,R Shiny服务器无法呈现正确的ggplot字体系列
我正在嘗試將一個漂亮的字體應用于在Shiny應用程序中呈現的ggplot .
使用family =“[fontname]”在RStudio中設置所需的字體(在同一服務器上)可以正常工作 . 這里要求使用“serif”字體系列:
但是,當ggplot嵌入到Shiny renderPlot({})函數中時,字體系列不會更改默認值 . 這里要求使用相同的“serif”字體系列:
字體大小和字體(粗體,斜體)的更改按預期工作 . 我已經在RStudio和閃亮的應用程序中使用fonts()和pdfFonts()檢查了已安裝的字體名稱,然后嘗試了列出的以及“serif”,“sans”和“mono”,但都無濟于事 . 我也嘗試過loadfonts() .
一個最小的例子:
server.R
require(ggplot2)
require(ggthemes)
require(extrafont)
shinyServer(function(input, output) {
df
output$the_plot
p
xlab("Alpha") +
ylab("Beta") +
geom_point() +
theme(text=element_text(family="serif", size=16))
print(p)
})
})
ui.R
library(shiny)
shinyUI(fluidPage(
sidebarLayout(
sidebarPanel(
h6("Font test")
),
mainPanel(
plotOutput("the_plot")
)
)
))
Edit: 有a similar unanswered question但是尋求pdf而不是png輸出 . 現在也嘗試過R基本圖形而不是ggplot,結果相同 .
總結
以上是生活随笔為你收集整理的shiny 服务器未响应,R Shiny服务器无法呈现正确的ggplot字体系列的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 游戏开发培训的两难与探索
- 下一篇: 宝宝取名六大要点