From murdoch at stats.uwo.ca  Wed Nov 25 21:57:19 2009
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Wed, 25 Nov 2009 15:57:19 -0500
Subject: [Rd] Question about image() behavior
In-Reply-To: <e61a0c7c0911251200k2e0ff7a7k3bb854068f124949@mail.gmail.com>
References: <e61a0c7c0911251200k2e0ff7a7k3bb854068f124949@mail.gmail.com>
Message-ID: <4B0D9A2F.7070703@stats.uwo.ca>

On 25/11/2009 3:00 PM, Justin McGrath wrote:
> If the x vector has a gap, then image() fills in those spots using the z
> value of the nearest x value. I had expected it to just leave those spaces
> blank though.
>
> For example
> x=c(1:5,100:105)
> y=c(1:10)
> z=matrix(rnorm(100),10,10)
> image(x,y,z)
>
> I expected that to produce a figure with a wide vertical gap between x=5 and
> x=100.
>
> Is this the correct behavior? Could there be an option added to choose
> between these two behaviors? Either way, it should be stated in the
> documentation.


It's doing what is documented.  Giving uneven spacing to x values just 
says that the rectangles being coloured by the z values are not square.

If you want to leave blanks, then put in NA values for z.

For example,

x <- c(1:6, 100:105)
y <- 1:10
z <- matrix(rnorm(110), 11, 10)
z[6,] <- NA
image(x,y,z)

Duncan Murdoch



[Rd] Question about image() behavior
Duncan Murdoch