更改轴标签的颜色

时间:2012-09-24 15:22:08

标签: 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"))

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

1 个答案:

答案 0 :(得分:26)

怎么样?
ggplot.3plus + theme(axis.text.x=element_text(colour="red"))

有关更多主题详情,请参阅ggplot2 wiki page

相关问题