Skip to content
Prev 350011 / 398506 Next

plotting rasters - no plot, no error

On Wed, 15 Apr 2015 at 02:49 Monica Pisica <pisicandru at hotmail.com> wrote:

            
Is this through Windows Remote Desktop? There's a note in ?rasterImage:

" Problems with the rendering of raster images have been
     reported by users of ?windows()? devices under Remote Desktop, at
     least under its default settings.
"

and see here:

https://stat.ethz.ch/pipermail/r-help//2013-July/357287.html

Note that raster::plot has arguments for the underlying image functions
 graphics::image and graphics::rasterImage - these are "interpolate" and
"useRaster".  The terminology is confusing, partly because rasterImage()
and its underlying code was put in base R at around the same time as the
extension package "raster" appeared. (rasterImage was originally called
"raster" so it's less confusing than it might have been)

The details get hidden because of the high-level plot() and image()
functions (and raster's additional methods for those), but essentially for
tracking down the ultimate cause you should see if you can reproduce with
the following four lines (without raster loaded):

data(volcano)
vn <- (volcano - min(volcano)) / diff(range(volcano))

## for each 1-4, close any open graphics windows first
## just to be sure (use dev.off() for convenience)

# 1.  image.default
image(vn)

# 2. rasterImage via image.default
image(vn, useRaster = TRUE)

# 3. rasterImage with interpolation
plot(0, xlim = c(0, 1),ylim = c(0,1), type = "n")
rasterImage(vn, 0, 0, 1, 1)

# 4. rasterImage without interpolation
plot(0, xlim = c(0, 1),ylim = c(0,1), type = "n")
rasterImage(vn, 0, 0, 1, 1,  interpolate = FALSE)

If you can reproduce the problem with these four cases, you have a clearer
basis to work from. These are the components from with raster's plot
methods are built, and I don't think raster is to blame here.

There might be settings for colour you can control with Remote Desktop.

Cheers, Mike.

I still don't know how to solve the problem, but thanks so much for an