Re: [R] image question

From: Charles C. Berry <cberry_at_tajo.ucsd.edu>
Date: Wed, 23 Jan 2008 15:37:09 -0800

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

Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry_at_tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901

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. Received on Wed 23 Jan 2008 - 23:39:48 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 24 Jan 2008 - 16:30:09 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive