This looks like raster/tiling graphics to me. There are several options. Personally I think the ggplot2
package does a good job.
I didn't use your provided example, however, because I think the data would best be organized in a long format. See code below for a simple example on how to do this:
require(ggplot2)
dat <- expand.grid(gene=1:10, subj=1:50)
dat$mut <- as.factor(sample(c(rep(0,300),rep(1,200)),500))
dat$mut[sample(500,300)] <- NA
ggplot(dat, aes(x=subj, y=gene, fill=mut)) +
geom_raster() +
scale_fill_manual(values = c("#8D1E0B","#323D8D"), na.value="#FFFFFF")
#dev.off()
The visual appearance can be optimized using the manual scales and the theming functions provided by ggplot2
. You can look that up in the documentation of the package:
http://docs.ggplot2.org/current/
EDIT:
To elaborate a bit more on the options that are supplied by ggplot2
to customoize appearance. A cleaner variant of the plot, with customized appearance and scales, may look like this:
ggplot(dat, aes(x=subj, y=gene, fill=mut)) +
geom_raster() +
scale_fill_manual(values = c("#8D1E0B","#323D8D"), na.value="#FFFFFF") +
scale_x_discrete("Subject") +
scale_y_continuous(breaks=1:10,
labels=c("D0","D1","D2","D3","D4","D5","D6","D7","D8","D9")) +
guides(fill=FALSE) +
theme(
axis.ticks.x=element_blank(), axis.ticks.y=element_blank(),
axis.text.x=element_blank(), axis.text.y=element_text(colour="#000000"),
axis.title.x=element_text(face="bold"), axis.title.y=element_blank(),
panel.grid.major.x=element_blank(), panel.grid.major.y=element_blank(),
panel.grid.minor.x=element_blank(), panel.grid.minor.y=element_blank(),
panel.background=element_rect(fill="#ffffff")
)
#dev.off()
Nonetheless, a look into the documentation of ggplot2
is very useful in developing your graphics and adjusting them to your needs.