我正在使用 R 包 GGPubr 来制作箱线图。我真的很喜欢它提供的漂亮视觉效果,但我遇到了问题。有谁知道如何增加轴上数字、轴标签和类标签的字体大小?另外,如何设置平均值以使它们仅显示 2 位小数?
这是我正在使用的代码:
library("ggpubr")
mydata <- read.csv("C:\\temp\\ndvi.csv")
ggboxplot(mydata, x = "class", y = "NDVI",
color = "class",
order = c("Conifer", "Deciduous", "Grasslands"), ggtheme=theme_gray(),
ylab = "NDVI Value", xlab = "Land Cover Class",
add="mean",
font.label = list(size = 30, face = "bold"))+ stat_summary(fun.data
= function(x) data.frame(y=1, label = paste("Mean=",mean(x))), geom="text")
+theme(legend.position="none")
和 csv:
NDVI,class
0.25,Conifer
0.27,Conifer
0.29,Conifer
0.403,Deciduous
0.38,Deciduous
0.365,Deciduous
0.31983489,Grasslands
0.32005,Grasslands
0.328887766,Grasslands
我更愿意使用 GGPubr 而不是 boxplot() 或 ggplot/ggplot 2 来实现上述预期效果。谢谢。