[R-br] dois gradientes de cores no ggplot2

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[R-br] dois gradientes de cores no ggplot2

R-br mailing list
Olá lista!

Alguém saberia como incluir dois gradientes de cores no mesmo conjunto de dados?
No ggplot? Tentei dividir o conjunto de dados, mas não rolou.

meu codigo foi:

> dat1
   change values
1     -10   0.00
2      -9   0.50
3      -8   0.20
4      -7   0.30
5      -6   0.00
6      -5   0.00
7      -4   0.61
8      -3   0.40
9      -2   1.00
10     -1   0.80

> dat2
   change values
1       5   0.61
2       3   1.00
3      10   0.50
4       2   0.00
5       7   0.00
6       6   0.50
7       8   0.00
8      10   0.30
9       6   0.61
10      6   0.20

p = ggplot() + xlim(-10, 10) + ylim(0,1) + labs(x= "change", y= "values")+
geom_point(data=dat1, aes(x=change, y=value, color=value), shape=19, size=3, alpha=0.5)+
scale_color_gradientn(colours=c("#FC4013","#FED246"))

p1 = p+geom_point(data=dat2, aes( x=change, y=value, color=value), shape=19, size=3, alpha=0.5)+
scale_color_gradientn(colours=c("#5CB0FD","#4DE775")) +
theme(axis.text.x = element_text(size=18,colour='grey8'),
         axis.text.y = element_text(size=18,colour='grey8'),
         axis.title.x = element_text(size=18,colour='grey8'),
         axis.title.y = element_text(size=20,colour='grey8'),
     strip.text.x = element_text(size=18,colour='grey8'),
         strip.background = element_rect(fill="transparent"),
    legend.position="none",
         legend.text=element_blank(),
         legend.title=element_blank(),
 legend.background = element_rect(fill="grey98", size=1, linetype="solid"),
         panel.background=element_rect("grey98"))
p1 + geom_vline(xintercept = 0,colour="grey68",linetype='twodash', size=2)+ geom_hline(yintercept = 0.5, colour="grey78")

--
Priscila Lemes, 

PhD in Ecology and Evolution - UFG
Post Doctoral, Department of Zoology, IB, UNESP - Rio Claro - São Paulo - Brazil
http://lattes.cnpq.br/7228776843625214
Skype: plemes_





_______________________________________________
R-br mailing list
[hidden email]
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forne�a c�digo m�nimo reproduz�vel.