更改轴标签的颜色 [英] Change the color of the axis labels

查看:153
本文介绍了更改轴标签的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是相关代码:

  ggplot.3plus< -ggplot(summary.3plus,aes(x = sp1,y = ay(ymin = fract.mean,fill = ForestAge))+ 
geom_bar(position = position_dodge())+ coord_cartesian(ylim = c(1,1.175))+
geom_errorbar se,ymax = fract.mean + se),
width = .2,#误差线的宽度
position = position_dodge(.9))

ggplot.3plus< - ggplot.3plus + theme(axis.title.x = element_text(color =red))

你可以看到,用最后一行代码,我可以改变轴标题的颜色,而不是轴的标签颜色。

解决方案



  ggplot.3plus + theme(axis.text.x = element_text(color =red ))

请参阅 ggplot2 wiki页面获取更多主题详情。


Here's the relevant code:

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"))

You can see that with the last line of code, I can change the color of the axis title, but not the color of the axis LABELS.

解决方案

What about

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

See ggplot2 wiki page for more theme details.

这篇关于更改轴标签的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆