Dear Assa,
attached is some code to get done approximately what you want to do. As
it is, you have repetitive information. That is, the color scale
represents the same information that is displayed on the yaxis. Next
time you just need to get your data more organized. This is a general
requirement for ggplot. Therefore:
library(ggplot2)
library(reshape2)
library(plyr)
target_sub <- dget("target_sub.txt")
target_miRNA_sub <- dget("target_miRNA_sub.txt")
target_sub <- rename(target_sub, c(ID.miRNA="miRNA"))
target <- rbind.fill(data.frame(target_sub, exp="standard"),
data.frame(target_miRNA_sub, exp="new method?"))
str(target)
ggplot(data=target, mapping = aes(x=as.factor(TXCHROM),
y=log2FoldChange.mRNA)) +
geom_point(aes(shape=as.factor(miRNA), color=log2FoldChange.mRNA),
size=3) +
scale_shape_manual(name = "miRNA targets", values = c(1:25)) +
scale_color_gradient2(name = "log2FC", low="blue", mid="grey",
high="red") +
geom_text(aes(label=label_gene),
size=4, hjust=0.4, vjust=1)
If you want your two different data sets to have different colors here,
I recommend that you rethink how you're using the color aesthetic here.
I mean:
geom_text(aes(label=label_gene, color=exp))
The color aesthetic can only be used once. Any aesthetic can only be
used once in a single plot. Different variables require different
aesthetics.
Hope that helps. Please note how I've included code to do everything,
including reading in the data. Please do that similarly next time.
Cheers,
Brian
> <
https://groups.google.com/d/optout>.