If any, I think there must be a very easy solution for this. I have two large dataframes that basically look like these:
> data1[1,]
chromosome start end test ref position log2 p.value
13600 Y 10199251 10200750 533 616 10200000 0.2181711 0.00175895
...
> data2[1,]
chromosome start end test ref position log2 p.value
4080 Y 10197501 10202500 403 367 10200000 0.04113596 0.3149926
...
I'm using this code to plot the two dataframes into the same graph:
p <- ggplot() + geom_point(data=subset(data1, p.value >= glim[1]),
map=aes(x=position, y=log2, colour=p.value))
+ geom_point(data=subset(data2, p.value >= glim[1]), map=aes(x=position,
y=log2, colour=p.value))
When I was plotting single dataframes, I was using a red-white color gradient for the values in "p.value" column. Using this line:
p <- p + scale_colour_gradient(limits=glim, trans='log10', low="red",
high="white")
The central issue is: Now with two dataframes, how can I set one color gradient for data1 and another for data2? I read in a previous post that it is not possible to use two different colour scales(ej. "low=" for the first, and "high=" for the second), but in this case is exactly the same kind of colour scale (If I'm not mixing up terminology). The syntax obviously is not correct but I'd like to do something like this:
p <- p + scale_colour_gradient(limits=glim, trans='log10', low="red",
high="white")
p <- p + scale_colour_gradient(limits=glim, trans='log10', low="blue",
high="white")
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…