Correlation heatmap using qplot function in ggplot2
1
0
Entering edit mode
8.4 years ago
Dtriumph ▴ 30

Hello everyone, I'm trying to generate a correlation heatmap for expression values of my RNAseq samples using qplot function in ggplot2. I could generate the heatmap using the below code and it's default color is blue. Now I need to change the color of the map to a red to yellow gradient and also to change the axes text size and color. Can anyone help me with this?

correlation<-read.table("new_cor.txt", header=TRUE)

library(ggplot2)

library(reshape2)

qplot(x = Var1 , y=Var2, data=melt(cor(correlation)), fill=value, geom="tile")

Thank you in advance!

RNA-Seq rna-seq genome • 3.1k views
ADD COMMENT
0
Entering edit mode
8.4 years ago
S.Warchal ▴ 30

The ggplot2 documentation is very good and there are countless tutorials, it's worth searching before asking simple questions,

Colour gradient : http://docs.ggplot2.org/current/scale_gradient.html

Axis formatting : http://www.cookbook-r.com/Graphs/Axes_%28ggplot2%29/

ADD COMMENT
0
Entering edit mode

I'm new to R, so still searching for resources. Thanks so much for the links! It worked nicely...

ADD REPLY
0
Entering edit mode

It's a little off-topic relative to the query as posed by the OP, but my personal choice for heatmaps in R is the plot.ly package. ggplot is fantastic but I found it a little more intractable for heatmaps specifically. Plot.ly's are interactive too which is nice.

ADD REPLY

Login before adding your answer.

Traffic: 2723 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