Skip to content

Instantly share code, notes, and snippets.

@py
Created March 5, 2014 02:49
Show Gist options
  • Save py/9360245 to your computer and use it in GitHub Desktop.
Save py/9360245 to your computer and use it in GitHub Desktop.
# Adaptation of http://martinsbioblogg.wordpress.com/2014/03/03/using-r-correlation-heatmap-take-2/ with labels
data <- airquality[,1:4]
library(ggplot2)
library(reshape2)
qplot(x=Var1, y=Var2, data=melt(cor(data, use="p")), fill=value, geom="tile") +
scale_fill_gradient2(limits=c(-1, 1)) +
geom_text(aes(label=round(melt(cor(data, use="p"))$value,2)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment