I am trying to create a plot like the following:
I have roughly got the left plot using geom_tile() from ggplot2, but I can't work out how to one generate the right-hand graph and how to get the two plots together.
Example:
tt <- structure(list(Gene = structure(c(3L, 1L, 2L, 4L, 4L, 4L, 2L, 3L, 1L, 3L, 1L, 2L, 1L, 2L, 4L), .Label = c("A", "B", "C", "D"), class = "factor"), tumour.sample = structure(c(1L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 3L, 3L, 4L, 4L, 2L), .Label = c("1", "5", "3", "4", "2", "6"), class = "factor"), Effect = c("missense", "missense", "missense", "missense", "missense", "missense", "missense", "nonsense", "missense", "missense", "missense", "missense", "missense", "nonsense", "missense")), .Names = c("Gene", "tumour.sample", "Effect"), row.names = c(1L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 18L), class = "data.frame")
ggplot(tt, aes(x=Gene, y=tumour.sample)) + geom_tile(aes(fill=Effect)) + theme(axis.text.x = element_text(angle = -90, hjust = 0))
What is the best approach to do this?
At the moment the heatmap doesn't have the labels at the top and the boxes are not square as well.