leglabs

0th

Percentile

Make legend labels

leglabs makes character strings from the same break points. The plot.polylist() function may be used as a generic S3 method.

Keywords
spatial
Usage
leglabs(vec, under="under", over="over", between="-", reverse=FALSE)
Arguments
vec

vector of break values

under

character value for under

over

character value for over

between

character value for between

reverse

flag to reverse order of values, you will also need to reorder colours, see example

See Also

findInterval

Aliases
  • leglabs
Examples
# NOT RUN {
mappolys <- readShapeSpatial(system.file("shapes/columbus.shp", package="maptools")[1], ID="NEIGNO")
brks <- round(quantile(mappolys$CRIME, probs=seq(0,1,0.2)), digits=2)
colours <- c("salmon1", "salmon2", "red3", "brown", "black")
plot(mappolys, col=colours[findInterval(mappolys$CRIME, brks,
 all.inside=TRUE)])
legend(x=c(5.8, 7.1), y=c(13, 14.5), legend=leglabs(brks),
  fill=colours, bty="n")
title(main=paste("Columbus OH: residential burglaries and vehicle",
 "thefts per thousand households, 1980", sep="\n"))
#legend with reversed order
plot(mappolys, col=colours[findInterval(mappolys$CRIME, brks,
 all.inside=TRUE)])
legend(x=c(5.8, 7.1), y=c(13, 14.5), legend=leglabs(brks, reverse = TRUE),
  fill=rev(colours), bty="n")
title(main=paste("Columbus OH: residential burglaries and vehicle",
 "thefts per thousand households, 1980 (reversed legend)", sep="\n"))
# }
Documentation reproduced from package maptools, version 0.9-5, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.