draw-key: Biplot key drawing functions

draw-keyR Documentation

Biplot key drawing functions

Description

These key drawing functions supplement those built into ggplot2 for producing legends suitable to biplots.

Usage

draw_key_line(data, params, size)

draw_key_crosslines(data, params, size)

draw_key_crosspoint(data, params, size)

Arguments

data

A single row data frame containing the scaled aesthetics to display in this key

params

A list of additional parameters supplied to the geom.

size

Width and height of key in mm.

Details

draw_key_line() is a horizontal counterpart to ggplot2::draw_key_vline(). draw_key_crosslines() superimposes these two keys, and draw_key_crosspoint() additionally superimposes an oversized ggplot2::draw_key_point().

Value

A grid grob.

See Also

ggplot2::draw_key for key glyphs installed with ggplot2.

Examples

# scaled PCA of Anderson iris data with ranges and confidence intervals
iris[, -5] %>%
  prcomp(scale = TRUE) %>%
  as_tbl_ord() %>%
  confer_inertia(1) %>%
  augment_ord() %>%
  mutate_rows(species = iris$Species) %>%
  ggbiplot(aes(color = species)) +
  theme_bw() +
  scale_color_brewer(type = "qual", palette = 2) +
  geom_rows_lineranges(fun.data = mean_sdl, linewidth = .75) +
  geom_rows_point(alpha = .5) +
  geom_cols_vector(color = "#444444") +
  geom_cols_text_radiate(aes(label = name), color = "#444444", size = 3) +
  ggtitle(
    "Row-principal PCA biplot of Anderson iris data",
    "Ranges 2 sample standard deviations from centroids"
  )

corybrunson/ordr documentation built on Feb. 15, 2024, 9:28 p.m.