I am trying to create a correlation heat map using ggplot, but I cannot seem to control the order of my variables on the x or y axis. Specifally, ggplot seems to try to order t
This works for me:
keep$Var1 <- factor(keep$Var1, levels = unique(keep$Var1), ordered = TRUE)
keep$Var2 <- factor(keep$Var2, levels = unique(keep$Var2), ordered = TRUE)
ggplot(keep,aes(Var1,Var2),xlab=NULL,ylab=NULL) + geom_tile(aes(fill = value),colour = "white") + scale_fill_gradient(low = "white",high = "steelblue")+theme(axis.title.x=element_blank(),axis.title.y=element_blank())