All helpful suggestions: thanks loads Baptiste, Barry, Jim. image() and
color2D.matplot() seem most easily adaptable for my purposes. I've copied a
couple of examples below for anyone else facing the same q's.
Best,
Peter

#color matrix
cseq<-seq(0,150,1)
lseq<-seq(0,100,1)
clen<-length(cseq)
llen<-length(lseq)
colmat<-matrix(,nrow=clen,ncol=llen)
for(i in 1:clen){
for(j in 1:llen){
colmat[i,j]<-hcl(h=0,c=cseq[i],l=lseq[j],fixup=F)
}
}
colmat[is.na(colmat)]<-hcl(c=0,l=100,fixup=F)

#display
#color2D.matplot()
x<-matrix(1,dim(colmat)[1],dim(colmat)[2])
color2D.matplot(x,cellcolors=colmat,border=NA)
#image()
m = colmat
mc = matrix(1:(nrow(m)*ncol(m)),nrow(m),ncol(m))
image(mc,col=m)





On 5 November 2010 06:55, Jim Lemon <j...@bitwrit.com.au> wrote:

> 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
>

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to