How can I have multiple colors for an axes label in ggplot?
As an example, instead of a legend, I would like the y-axis label to be red and green to correspond to the different points in the following plot:
p <- ggplot(mpg[mpg$model=="a4",],aes(x=trans,y=cty))+geom_point(color="red")+
geom_point(aes(y=hwy),color="dark green") +
ylab("MPG (city); MPG (hwy)")
I know I can control the color of the entire y-axis label using theme as follows:
p <- p + theme(axis.title.y = element_text(color="red"))
But, in the plot I want the "MPG (hwy)" to be in dark green. Is there a way to do this in ggplot?