Here is another approach that may or may not be easier: > library(TeachingDemos) > > x <- 0:4 > y <- 0:20 > > z <- matrix( runif(80), ncol=20 ) > > image(x,y,z) > > clipplot( image(x,y,z, col=heat.colors(12), add=TRUE), xlim=c(0,1) ) > clipplot( image(x,y,z, col=terrain.colors(12), add=TRUE), xlim=c(1,2) ) > clipplot( image(x,y,z, col=topo.colors(12), add=TRUE), xlim=c(2,3) ) > clipplot( image(x,y,z, col=cm.colors(12), add=TRUE), xlim=c(3,4) ) >
Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Charles C. Berry > Sent: Wednesday, January 23, 2008 4:37 PM > To: Ajar > Cc: R-help@r-project.org > Subject: Re: [R] image question > > On Wed, 23 Jan 2008, Ajar wrote: > > > Hi, > > > > I have a question regarding the image function. Is there a way to > > specify a separate color set for each column in the matrix? > > Yes. But it will require some attention to the scaling of your matrix. > > This shows how it might be done: > > > mat <- matrix( runif(100), nc=10) > > image( mat + rep( 1:2, > > each=50),col=c(topo.colors(10),heat.colors(10))) > > Add an offset to the matrix to choose a different color scheme. > > Of course, the step size for the offset needs to be greater > than or equal to the range of values that you are representing. > > You will need to specify zlim to be sure this works right. > > HTH, > > Chuck > > > > > TIA, > > ajar. > > > > ______________________________________________ > > 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. > > > > Charles C. Berry (858) 534-2098 > Dept of > Family/Preventive Medicine > E mailto:[EMAIL PROTECTED] UC San Diego > http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San > Diego 92093-0901 > > ______________________________________________ > 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. > ______________________________________________ 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.