0

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:

enter image description here

 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 ;)

Phil
  • 7,287
  • 3
  • 36
  • 66
  • Please provide a [minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – Samuel Dec 15 '20 at 17:23
  • can't reproduce the error. With an example dataset, there is no issue with `scale_color_gradient2` – mischva11 Dec 16 '20 at 00:32

0 Answers0