[R] Plotting a grid of directly specified colours

baptiste Auguié baptiste.auguie at googlemail.com
Thu Nov 4 17:44:26 CET 2010


Hi,

try this,

library(grid)
grid.raster(matrix(colors(),ncol=50),interp=F)

HTH,

baptiste


On Nov 4, 2010, at 5:00 PM, 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) .
> 
> Best wishes and thank you,
> 
> Peter Davenport
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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