I have plot quite easily a matrix (thus giving a heatmap) with ggplot
like this:
test <- data.frame(start1=c(1,1,1,1,2,2,2,3,3,4),start2=c(1,2,3,4,2,3,4,3,4,4),logFC=c(5,5,1,0,8,0,5,2,4,3))
ggplot(test, aes(start1, start2)) +
geom_tile(aes(fill = logFC), colour = "gray", size=0.05) +
scale_fill_gradientn(colours=c("#0000FF","white","#FF0000"), na.value="#DAD7D3")
Since I have only the lower part of the heatmap, it gives this plot:
But I would like to rotate the matrix 45 degrees, just like I can find here: Visualising and rotating a matrix. So, the diagonal next to the X axis. However, they use the graphics from R without ggplot
. Do you have any idea how to do that with ggplot
?