更新时间:2023-11-26 23:49:28
Try this, using opts
:
dat <- data.frame(x = 1:5,y = 1:5)
p <- ggplot(dat,aes(x,y)) + geom_point()
p + opts(axis.title.x = theme_text(colour = "red"),
axis.title.y = theme_text(colour = "blue"))
This page is a good starting point for learning about all the options.
Since the release of ggplot2 0.9.2 opts
has been deprecated. The syntax for the current release would be something more like this:
p + theme(axis.title.x = element_text(colour = "red"),
axis.title.y = element_text(colour = "blue"))
There is detailed transition guide for updating your code.