Skip to contents

guide_urban() is the legend of the Urban Atlas plates: one key for each class, each followed by the range of the class, in a single row. It is the default guide of scale_level_binned(). For other scales it behaves like ggplot2::guide_legend().

Usage

guide_urban(
  title = ggplot2::waiver(),
  labels = label_urban_range(),
  ink = NULL,
  nrow = 1,
  ...
)

label_urban_range(sep = middle_dot, prefix = "", over = "over ")

Arguments

title

The legend title.

labels

A function of two arguments, the lower and upper bound of each class, that returns the labels. The upper bound of the highest class is Inf.

ink

The ink of the legend title and labels: a role from urban_inks(), such as "income", or any colour. The default, NULL, leaves the colour to the theme. Set it when a plate has two legends in different inks.

nrow

The number of rows of keys.

...

Other arguments passed on to ggplot2::guide_legend().

sep

The separator between the bounds of a class. The default is a centred dot with a space on each side.

prefix

Text placed before the first number of each label, such as "$".

over

The wording for the open-ended highest class.

Value

guide_urban() returns a ggplot2 guide. label_urban_range() returns a labelling function.

Details

label_urban_range() makes the range labels: the bounds of each class separated by a centred dot, and over 3600 for the highest class.

Examples

label_urban_range()(c(50, 200, 3600), c(200, 500, Inf))
#> [1] "50 · 200"  "201 · 500" "over 3600"
label_urban_range(prefix = "$")(c(0, 250000), c(250000, Inf))
#> [1] "$0 · 250,000"  "over $250,000"