[R] image() function

Greg Snow Greg.Snow at imail.org
Fri Mar 26 16:36:53 CET 2010


Use the zlim argument to image:

m <- matrix(1:18,3,6)

par(mfrow = c(2,1))
image(1:6, 1:3, t(m), col = rainbow(20), zlim=c(0,30))
image(1:6, 1:3, t(m+9), col = rainbow(20), zlim=c(0,30))

hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Jorge Hernandez
> Sent: Friday, March 26, 2010 4:21 AM
> To: r-help at r-project.org
> Subject: [R] image() function
> 
> Hello.
> 
> I would like to know how to set the image() function so that it assigns
> colors
> relative to an absolute scale, as opposed to relative to the values
> present
> in a particular call to image().
> 
> For example:
> 
> m <- matrix(1:18,3,6)
> 
> par(mfrow = c(2,1))
> image(1:6, 1:3, t(m), col = rainbow(20))
> image(1:6, 1:3, t(m+9), col = rainbow(20))
> 
> Then the two images are identical.  But the right half of the first
> matrix
> 
> coincides (numerically) with the left half of the second.   (i.e.
> compare
> 'm' and 'm+9'.)
> 
> So the question is: how can image() (or some other function) assign the
> same color to every incidence of any given value across repeated calls
> to image()?
> 
> Thanks in advance.
> 
> JH
> 
> 
> 
> ***********************************************************************
> ***************************************
> 
> PRIVATE & CONFIDENTIAL: This email and any files transmitted with it
> are confidential. Any unauthorized use of the information contained in
> t
> his email or its attachments is prohibited.  If this email is received
> in error, please contact the sender and delete the material from your
> computer systems. Do not use, copy, or disclose the contents of this
> email or any attachments.
> 
> Abu Dhabi Investment Authority (ADIA) does not enter into contracts or
> provide undertakings by email.  ADIA accepts no responsibility for the
>  content of this mail to the extent that it is unrelated to its
> activities or the same consists of statements or opinions  which are
> the send
> er's own and not made on behalf of ADIA.  ADIA does not accept any
> liability for any errors or omissions in the content of this email
> caused
> by electronic and technical failures. Although ADIA has taken
> reasonable precautions to ensure that no viruses are present in this
> email, ADI
> A accepts no responsibility for any loss or damage arising from the use
> of this email or its attachments.
> 
> ***********************************************************************
> ***************************************
> 
> 	[[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