Description Usage Arguments Examples
Print to screen the legend of a spatial object.
1 2 3 4 | show_legend(object)
## S4 method for signature 'RasterLayer'
show_legend(object)
|
object |
an object of type raster |
1 2 3 4 5 6 7 8 9 10 11 12 13 | library(raster)
landcover <- getgcvn()
leg <- show_legend(landcover)
colors <- leg$color
plot(landcover, col = colors, legend = FALSE, axes = FALSE)
l <- length(colors)
x <- ceiling(l / 2)
sel1 <- 1:x
sel2 <- (x + 1):l
legend("left", legend = leg$code[sel1], fill = colors[sel1], bty = "n")
legend("right", legend = leg$code[sel2], fill = colors[sel2], bty = "n")
leg
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.