在ggplot中更改x轴刻度颜色

The*_*ust 2 plot r ggplot2

我正在尝试将X.axis刻度颜色的颜色更改为Black,如下所述:https: //github.com/hadley/ggplot2/wiki/Axis-Attributes#axistextx-text
但是当我运行我的代码时收到错误消息:
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)
Run Code Online (Sandbox Code Playgroud)

我基本上试图绘制没有网格和白色BG的直方图.任何人都可以纠正这个问题.

Mar*_*sen 6

看起来您可以更新您的版本ggplots或使用"旧"方式更改文本颜色.opts(axis.text.x = theme_text(colour="black"), axis.text.y = theme_text(colour="black"))

应该是正确的语法theme(axis.text.x = element_text(colour="black"), axis.text.y = element_text(colour="black")).