The August
The August

Reputation: 469

Changing x-axis tick colour in a ggplot

I'm trying to change the colour of the X.axis tick colour to Black, as described here: https://github.com/hadley/ggplot2/wiki/Axis-Attributes#axistextx-text
However when I run my code I'm getting the error message:
Error: could not find function "theme"

ggplot(long.repmixed.df, aes(x = log10intensity, colour = channel, fill = channel)) +
geom_bar(position="dodge") +
theme(axis.text.x = element_text(colour = "black")) +
opts(panel.background = theme_rect(fill = 'white', colour = 'black')) +
opts(panel.grid.major = none, panel.grid.minor = none)

I'm basically trying to plot a histogram with no grid and white BG. Can anybody rectify the problem please.

Upvotes: 2

Views: 15241

Answers (1)

Mark Nielsen
Mark Nielsen

Reputation: 1001

It looks like you can either update your version of ggplots or use the 'old' way of changing the text color. opts(axis.text.x = theme_text(colour="black"), axis.text.y = theme_text(colour="black"))

The correct syntax should be theme(axis.text.x = element_text(colour="black"), axis.text.y = element_text(colour="black")).

Upvotes: 9

Related Questions