I am using a heatmap to draw a figure in ggplot2 for different datasets. The problem is: everytime I draw a heatmap, the column width varies and thus the graphs look inconsistent next to one another.
As you can see here, the width of the colored columns is different.
This is the code I am using:
p <- ggplot(data, aes(x=Codon,y=ID,fill=state))
q <- p + geom_raster()
And this is sample data:
structure(list(ID = c("281154_491", "281154_491", "281154_491",
"281154_491", "281154_491", "281154_491"), Codon = c(18L, 28L,
79L, 81L, 84L, 86L), state = c("possible_adapted", "nonadapted",
"nonadapted", "nonadapted", "nonadapted", "nonadapted")), .Names =
c("ID", "Codon", "state"), row.names = c(NA, 6L), class = "data.frame")
Thanks