band: A band

View source: R/prop_band.R

bandR Documentation

A band

Description

Bands are used to set the width or height on categorical scales - a band represent the height or width allocated for one level of a factor.

Usage

band(offset = NULL, mult = NULL)

is.prop_band(x)

Arguments

offset, mult

Additive and multiplicate offsets used to adjust the band size. For example, use mult = 0.9 to make a bar take up 90% of the space allocated for its category.

x

object to test for band-ness

Examples

df <- data.frame(label = c("a", "b", "c"), n = c(10, 9, 4))

base <- df %>% ggvis(~label, y2 = 0, y = ~n)
base %>% layer_rects(width = band())
base %>% layer_rects(width = band(offset = -1))
base %>% layer_rects(width = band(mult = 0.9))

# A nominal scale with padding is more symmetrical than band with a mult
base %>% layer_rects(width = band(mult = 0.75))
base %>% layer_rects(width = band()) %>%
  scale_nominal("x", padding = 0.25, points = FALSE)

ggvis documentation built on May 29, 2024, 1:12 a.m.