[R-sig-Geo] sp and latticeExtra: add colorbar for layer drawn 'under'
btupper at bigelow.org
Fri Aug 28 16:33:17 CEST 2015
I have drawn on the following posting to draw a raster 'under' a set of polygons as shown in the image link below. The data used is available at the third link (about 650KB).
Example data: https://dl.dropboxusercontent.com/u/8433654/example.RData
Here is a brief description of each variable plotted.
R is a single layer RasterStack of sea surface temperatures
qa is a SpatialPolygonsDataFrame of fisheries management polygons
spdfbb is also a SpatialPolygonsDataFrame that contains a single polygon (created from the extent of qa)
colorkey = FALSE,
sp.layout = list(b = list('sp.polygons', qa, col = 'grey', first = FALSE))) +
latticeExtra::as.layer(spplot(R), under = TRUE)
Is it possible add a colorbar for the raster, R, as it might appear if I called...
Session info is below my signature.
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
R version 3.2.2 (2015-08-14)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.9.5 (Mavericks)
attached base packages:
 stats graphics grDevices utils datasets methods base
other attached packages:
 latticeExtra_0.6-26 lattice_0.20-33 rgeos_0.3-8 obpgcrawler_0.1 ecocastmap_0.1
 RColorBrewer_1.1-2 ggplot2_1.0.1 rgdal_0.9-3 spnc_0.1 raster_2.4-15
loaded via a namespace (and not attached):
 Rcpp_0.12.0 magrittr_1.5 MASS_7.3-43 munsell_0.4.2 colorspace_1.2-6 R6_2.1.1
 stringr_1.0.0 httr_1.0.0 plyr_1.8.3 tools_3.2.2 grid_3.2.2 gtable_0.1.2
 digest_0.6.8 reshape2_1.4.1 ncdf4_1.13 curl_0.9.3 stringi_0.5-5 scales_0.2.5
 XML_3.98-1.3 proto_0.3-10
More information about the R-sig-Geo