Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the color of the axis labels

Tags:

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.

like image 509
Luke Avatar asked Sep 24 '12 15:09

Luke


People also ask

How do I change the color of my axis labels?

To set the color for X-axis and Y-axis, we can use the set_color() method (Set both the edgecolor and the facecolor). To set the ticks color, use tick_params method for axes. Used arguments are axis ='x' (or y or both) and color = 'red' (or green or yellow or ...etc.)

How do you change axis label color in Excel?

Just click to select the axis you will change all labels' font color and size in the chart, and then type a font size into the Font Size box, click the Font color button and specify a font color from the drop down list in the Font group on the Home tab.


1 Answers

What about

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

See ggplot2 wiki page for more theme details.

like image 74
csgillespie Avatar answered Sep 20 '22 08:09

csgillespie