displaying UP, DOWN, and NON-regulated genes
2
0
Entering edit mode
Bogdan ▴ 670
@bogdan-2367
Last seen 6 months ago
Palo Alto, CA, USA

Dear all,

 

may I ask for a simple advice on how to make a scatter plot in ggplot2 that colours differently UP, DOWN and NON-regulated genes (in total, 5000 genes). BUT would like to show the NON-reg genes in the background (perhaps in a GREY transparent color), and bring in the foreground only UP-- and DOWN- genes.

a piece of example at a smaller scale is below, although we work with > 5000 genes. thanks a lot !

 

mycolours <- c("U" = "green", "D" = "red", "U"="grey")

x <- c(1,2,3,4,5,6)
y <- c(1,2,3,4,5,6)
z <- c("U","U","D","D","N", "N")
t <- data.frame(x,y,z)

ggplot(data = t, aes(y = y, x = x)) +
                 geom_point(size=2, aes(colour=z)) +
                 scale_color_manual("Status", values = mycolours)

 

 

ggplot2 • 1.8k views
ADD COMMENT
0
Entering edit mode
@gordon-smyth
Last seen 3 hours ago
WEHI, Melbourne, Australia

ggplot2 is not a Bioconductor package so, if you want help with it, better to consult the ggplot2 documentation:

  http://docs.ggplot2.org/current/

or post to the ggplot2 forum:

  https://groups.google.com/forum/#!forum/ggplot2

or write to the package authors.

Personally I use the plotWithHighlights() and plotMD() functions of the limma package, which are specifically designed for the purpose you describe. For example:

plotWithHighlights(x,y,status=z,values=c("U","D"),hl.col=c("green","red"))

The argument 'values' specifies the foreground points. Any other values of 'status' not listed by 'values' are assumed to be background. The foreground colors are specified by hl.col and the background by bg.col. If you are using diffHic, for example, you'll find that these functions are already loaded for you.

ADD COMMENT
0
Entering edit mode
Bogdan ▴ 670
@bogdan-2367
Last seen 6 months ago
Palo Alto, CA, USA

thank you Gordon ! it is a very good suggestion, thanks a lot !

will get back to you shall I have any questions regarding how to set the genes display in the BACKGROUND vs FOREGROUND.

ADD COMMENT

Login before adding your answer.

Traffic: 885 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6