show_legend-methods: Show legend

Description Usage Arguments Examples

Description

Print to screen the legend of a spatial object.

Usage

1
2
3
4
show_legend(object)

## S4 method for signature 'RasterLayer'
show_legend(object)

Arguments

object

an object of type raster

Examples

 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

choisy/globcoverVN documentation built on Aug. 22, 2019, 12:42 a.m.