Skip to contents

Draws the marker of geom_focus() with the label of its legend entry inside. The label is looked up from the info value of the key in params$info_labels; without a match only the marker is drawn.

Usage

draw_key_focus(data, params, size)

Arguments

data

A single row data frame with the scaled aesthetics.

params

A list of layer parameters.

size

Width and height of the key in mm (unused).

Value

A grid graphical object (grob) drawn as the key of a legend entry: a gTree with the marker and its label, or a points grob with the marker only when no label is found.

Examples

key <- data.frame(
  colour = "black", fill = "white", shape = 21, size = 6, stroke = 0.5,
  alpha = NA, family = "", fontface = 1, info = "Mazda RX4"
)
params <- list(info_labels = c("Mazda RX4" = "1"), text.size = 3.87)
grob <- draw_key_focus(key, params)
grid::grid.newpage()
grid::grid.draw(grob)