更改轴标签的颜色

Luk*_*uke 17 r ggplot2 axis-labels

这是相关的代码:

ggplot.3plus<-ggplot(summary.3plus, aes(x=sp1, y=fract.mean, fill=ForestAge)) + 
  geom_bar(position=position_dodge())+ coord_cartesian(ylim = c(1, 1.175))+
  geom_errorbar(aes(ymin=fract.mean-se, ymax=fract.mean+se),
                width=.2,                    # Width of the error bars
                position=position_dodge(.9))

ggplot.3plus<- ggplot.3plus + theme(axis.title.x = element_text(colour = "red"))
Run Code Online (Sandbox Code Playgroud)

您可以看到,使用最后一行代码,我可以更改轴标题的颜色,但不能更改轴LABELS的颜色.

csg*_*pie 29

关于什么

ggplot.3plus + theme(axis.text.x=element_text(colour="red"))
Run Code Online (Sandbox Code Playgroud)

有关更多主题详细信息,请参阅ggplot2 wiki页面.