[R] Plotting a Trivial Matrix

baptiste auguie baptiste.auguie at googlemail.com
Fri Feb 26 11:34:28 CET 2010


On 26 February 2010 11:12, Lorenzo Isella <lorenzo.isella at gmail.com> wrote:

> Thanks Augustine and Jim for the prompt reply.
> You both answered my question. To avoid another post, I would simply like to
> know if something along these lines is doable also with ggplot2.
> Many thanks
>
> Lorenzo
>

Augustine???

Anyhow, with ggplot2,

m <- matrix(rnorm(200) > 0,  ncol=20)

require(ggplot2)

d <- melt(m)
qplot(X1, X2, data=d, fill=value, geom="tile") +
  scale_fill_manual(values=c("white", "black"))

HTH,

baptiste



More information about the R-help mailing list