использование двух масштабных цветовых градиентов на одном ggplot

Я хотел бы объединить градиент цветовой шкалы для точек на диаграмме рассеяния вместе с градиентом цветовой шкалы для некоторого текста, который идет на графике. Я могу сделать их по отдельности, как показано в моем примере ниже, но я не могу соединить их ... есть ли способ сделать это?

Вот мой пример кода двух типов графиков (p и p1), которые я хочу объединить

l <- data.frame(prev=rnorm(1266), 
            aft=rnorm(1266), 
            day=as.factor(wday(sample(c(2:6),1266,replace=TRUE),abbr=TRUE, label=TRUE)), 
            month=as.factor(month(Sys.Date()+months(sample(0:11,1266,replace=TRUE)),abbr=TRUE, label=TRUE)), 
            ind=c(1:1266))
cors <- ddply(l, c("month", "day"), summarise, cor = round(cor(prev, aft), 3))


# below the text gains the colour gradient
p <- ggplot(l, aes(x=prev, y=aft)) + 
    geom_point() + 
    scale_colour_gradient(low = "red", high="blue")+ 
    facet_grid(day~month, scales="free_x")+
    geom_text(data=cors,aes(label=paste("r= ",cor,sep=""), size=abs(cor), colour=cor), x=Inf, y=Inf, vjust=1, hjust=1, show_guide=FALSE)+
    geom_hline(aes(yintercept=0))+
    geom_smooth(method="loess")
p

# below the points gain the colour gradient
p1 <- ggplot(l, aes(x=prev, y=aft)) + 
    geom_point(aes(colour=ind)) + 
    scale_colour_gradient("gray")+ 
    facet_grid(day~month, scales="free_x")+
    geom_text(data=cors,aes(label=paste("r= ",cor,sep=""), size=abs(cor), colour=cor), x=Inf, y=Inf, vjust=1, hjust=1, show_guide=FALSE)+
    geom_hline(aes(yintercept=0))+
    opts(legend.position="none") +
    geom_smooth(method="loess")

p1

Ответы на вопрос(1)

Ваш ответ на вопрос