He R users,
I have been struggling to plot a boundary map over the raster maps. I tried 
using the following example, but the boundary map could not be displayed over 
the three raster maps.
It works if we plot for a single raster. However when I want to plot the three 
maps using "levelplot" and add the boundary map it did not work.  I wanted to 
plot three raster same time because the "levelplot" so that we can compare the 
maps as they have only one legend.

My example code is given below, do you have any suggestions?


library(gridExtra)

library(raster)

library(sp)

library(rasterVis)

library(rgdal)

library(maptools)


boundary<- readShapeSpatial("boundrymap.shp")


minTemp<-raster("minTemp.tif")

maxTemp<-raster("maxTemp.tif")

averageTemp<-raster("averageTemp.tif")

Temp<-stack(minTemp,maxTemp,averageTemp)


levelplot(Temp, layout=c(1,3))+ layer(sp.polygons(boundary, col = "yellow"))

thanks


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to