我该如何在ggplot2中更改x轴标签的名称?请参见下文:
ggbox <- ggplot(buffer, aes(SampledLUL, SOC)) + geom_boxplot()
ggbox <- ggbox + theme(axis.text.x=element_text(color = "black", size=11, angle=30, vjust=.8, hjust=0.8))
ggbox<- ggbox + labs(title = "Land cover Classes") + ylab("SOC (g C/m2/yr)") + xlab("Land cover classes")
上面的代码创建了以下图形:
我想要大写这些类的第一个字母(例如Crop,而不是crop)。
我已经尝试了下面的代码,但不确定应该放在哪里以及使用什么函数。
labels = c("Citrus", "Crop", "Cypress Swamp", ..........)
(我正在使用Windows 7和Rstudio)
str_to_sentence
可用于生成所需的大写格式。 https://stringr.tidyverse.org/reference/case.html - flies