【发布时间】:2020-04-09 14:25:40
【问题描述】:
是否可以更改以下 ggpboxplot 中 p 值的字体系列?字体系列应为“Times New Roman”。
使用 theme_bw(base_family = "Times New Roman"),不会改变 p 值。
library(ggpubr)
library(ggplot2)
data("ToothGrowth")
# Box plot
p <- ggboxplot(ToothGrowth, x = "supp", y = "len",
color = "supp", palette = "jco",
add = "jitter",
facet.by = "dose", short.panel.labs = FALSE)
p + stat_compare_means(label = "p.format")
p + theme_bw(base_family = "Times New Roman")
我也尝试过使用普通主题(文本 = ...)。它不起作用。
# Box plot
p <- ggboxplot(ToothGrowth, x = "supp", y = "len",
color = "supp", palette = "jco",
add = "jitter",
facet.by = "dose", short.panel.labs = FALSE)
p + stat_compare_means(label = "p.format")
p + theme(text = element_text(family = "Times New Roman"))
请注意:我从以下网站获取示例: https://rpkgs.datanovia.com/ggpubr/reference/stat_compare_means.html
非常非常感谢!
一切顺利, 艾娜
【问题讨论】:
标签: r ggplot2 font-family