This should work:

plot(list.of.rasters[[1]])

You could also make a RasterStack instead of a list:

r <- raster(nrows=36, ncols=18)
r <- setValues(r, runif(ncell(r)))
r4 <- stack(r,r,r,r)
plot(r4)

#extract first layer and plot
plot(raster(r4,1))

See also:
?addLayer

Best,

Jacob.

--- On Fri, 5/14/10, Roman Luštrik <roman.lust...@gmail.com> wrote:

From: Roman Luštrik <roman.lust...@gmail.com>
Subject: [R-sig-Geo] trying to plot listed RasterLayers
To: "r-sig-geo" <r-sig-geo@stat.math.ethz.ch>
Date: Friday, May 14, 2010, 10:45 AM

I have created a list of RasterLayers and am trying to plot each layer
individually by extracting it from a list. I get the error listed below. I
have tried unlist() but it's not working for some reason. Can anyone suggest
how to make it plot?

> plot(list.of.rasters[[1]][1])
Error in xy.coords(x, y, xlabel, ylabel, log) :
  'x' is a list, but does not have components 'x' and 'y'


Cheers,
Roman


-- 
In God we trust, all others bring data.

    [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo



      
        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to