This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Correlation heatmap using qplot function in ggplot2

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

1 answer

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/

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

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.

Log in to answer this question.