[R] Plotting a grid of directly specified colours

Jim Lemon jim at bitwrit.com.au
Fri Nov 5 07:55:36 CET 2010


On 11/05/2010 03:00 AM, Peter Davenport 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) .
>
Hi Peter,

Yet another suggestion:

# calculate the vector of colors
cellcol<-...
color2D.matplot(...,cellcolors=cellcol,...)

Jim



More information about the R-help mailing list