From simon.urbanek at r-project.org  Wed Feb  9 04:03:28 2011
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Tue, 8 Feb 2011 22:03:28 -0500
Subject: [Rd] using rasterImage within image
In-Reply-To: <4D51F2A7.8010505@mcmaster.ca>
References: <4D51F2A7.8010505@mcmaster.ca>
Message-ID: <D8F5413E-025A-4511-BCE1-7ED06CBE99A0@r-project.org>

Ben,

did you actually look at the result of your function with useRaster=TRUE ? ;) [Hint: don't use an image that is symmetric]

Apart from that nice bug there are more issues as well, try
image(matrix(1:4,2),col=1:3)
The underlying issue is that as.raster() is not quite what you would hope. Unfortunately I'm not aware of an easy fix (that doesn't involve going back to RGB decomposition).

In general, I think it's a nice option, but I don't think you'll get away with only a few lines...

Cheers,
Simon



On Feb 8, 2011, at 8:49 PM, Ben Bolker wrote:

> 
>  Has anyone yet tried incorporating rasterImage into the base image()
> function?  It seems to make a *huge* difference, with
> a very small number of added/changed lines of code.  (Of course I have
> barely tested it at all.)
>  Is there any reason this *shouldn't* go into the next release?
> 
>> source("image.R")
>> z <- matrix(runif(1e6),nrow=1000)
>> image(z)
>> image(z,useRaster=TRUE)
> 
>  (Patch against SVN 54284 attached; people can contact me if it doesn't
> go through and they want it.)
> 
>  Ben Bolker
> 
> <image_diff.txt>______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] using rasterImage within image
Simon Urbanek