[英]Font change in ggplot not working on biplot label names
我偶然發現了一個問題,我可以將雙標圖像中的所有文本更改為另一種字體,標簽除外。
我使用的代碼也附上。 我找不到解決此問題的方法,希望有人可以提供幫助。
p <- fviz_pca(fit, geom = c("point"),
repel = TRUE, label = "var",
habillage = IOSDV1$Fertilisation,
addEllipses = TRUE, ellipse.type="confidence",
palette = "npg", labelsize = 5, pointsize = 3,
col.ind = "black", col.var = "black", arrowsize = 0.6) +
theme_bw(base_family = "Palatino Linotype") +
theme(text = element_text(family = "Palatino Linotype", size = 14)) +
labs(title = "")
ggsave(filename = "ggplot_garamond.png", dpi = 600, type = "cairo")
回答
您必須將font.family
參數添加到fviz_pca
:
fviz_pca(fit, geom = c("point"),
repel = TRUE, label = "var",
habillage = IOSDV1$Fertilisation,
addEllipses = TRUE, ellipse.type="confidence",
palette = "npg", labelsize = 5, pointsize = 3,
col.ind = "black", col.var = "black", arrowsize = 0.6,
font.family = "Palatino Linotype")
基本原理
在內部, fviz_pca
調用fviz
,后者又調用ggpubr::ggscatter
。 在此 function 中,您可以使用font.family
參數指定字體系列。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.