I´m trying to integrate ChIP-seq, ATAC-seq and RNA-seq data in the same plot. I would like to color each highlighted point (blue and red) according to Log2FC RNA-seq, however when I try to use scale_color_gradient2 the following error appears: "Error: colours encodes as numbers must be positive"
Downregulated and upregulated genes are coloured in blue and red, respectively:
ggplot(df, aes(x = logfc_atac, y = logfc_chip))+
ylim(-7,5)+
xlim(-5,5)+
theme(panel.border = element_rect(fill = NA, colour="black"),
panel.grid.major = element_blank(),panel.grid.minor = element_blank(),
panel.background = element_blank(),axis.line = element_line(colour = "black"))+
labs(x = "Log2FC ATAC-seq", y = "Log2FC ChIP-seq", color = "Log2FC RNA-seq")+
geom_point(size=1,col="grey",alpha = 0.3, na.rm = T) +
geom_point(data=down, aes(size=-log10(down[["fdr_rna"]])),col=down[["logfc_rna"]],alpha = 0.8, na.rm = T)+
geom_point(data=up, aes(size=-log10(up[["fdr_rna"]])),col=up[["logfc_rna"]],alpha = 0.8, na.rm = T)+
scale_color_gradient2(name="Log2FC RNA-seq",
breaks = c(-6,-3, 0,3,6),
label= c(-6,-3, 0, 3,6),
midpoint=0,
high = "firebrick", mid="white",low = "navy")
Thank you very much for the help. And, please, forgive my coding...I´m just starting to use R ;)