[R] color matrix

baptiste auguie baptiste.auguie at googlemail.com
Wed Jan 27 22:39:58 CET 2010


Hi,

It's easy with ggplot2,

cols = matrix(c("#F7FBFF", "#DEEBF7", "#C6DBEF", "#9ECAE1", "#6BAED6",
"#4292C6", "#2171B5", "#08519C" ,"#08306B"), ncol=3)

library(ggplot2)
m = melt(cols)
qplot(factor(X1),factor(X2),data=m, fill=value, geom="tile") +
  scale_fill_identity()

HTH,

baptiste

2010/1/27 evgeny55 <evgeny55 at yahoo.com>:
>
> Hi,
> Is it possible to create a heatmap for say a 3x3 matrix of data where every
> color is pre-assigned?
> I can easily create a matrix of hex colors but when I try to use that matrix
> as the parameter for the 'col' option it doesn't work.  If it's possible to
> just display a matrix of hex colors that would work as well
>
> thanks
> --
> View this message in context: http://n4.nabble.com/color-matrix-tp1312078p1312078.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list