On Thu, Nov 4, 2010 at 4:00 PM, Peter Davenport <pwdavenp...@gmail.com> wrote: > Dear R-help, > > Could any of you direct me to a function for plotting a grid of colours, > directly specified by a matrix of hex colour codes? In other words I'm > looking for a heatmap() or image()-like function to which I can specify the > colour of each grid location directly, rather than providing a numerical > matrix and a 1D-colour scale (heatmap, image, levelplots,NeatMap...). I'm > surprised I haven't found anything simple with RSiteSearch, > help.search, net. > > I'd like to use this function to encode one variable as "chroma" and a > second as "luminance" (hcl colour space), so that the two variables can be > visualised in a single heatmap (the variable are fold-change and a q-value, > a significance measure). If anyone has any thoughts/warnings to offer re > this idea then I'd love to hear them (it must have been tried before, but > I've not come across any examples) .
I've kludged this kind of thing in the past. Create a matrix of 1:(nrow*ncol), and specify the col as your colour matrix. Example: m = matrix(c("red","green","blue","yellow","orange","black"),2,3) mc = matrix(1:(nrow(m)*ncol(m)),nrow(m),ncol(m)) image(mc,col=m) Barry ______________________________________________ R-help@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.