Learn R Programming

ggtext (version 0.2.0)

draw_key_richtext: Key glyph for rich text

Description

This is a function for rendering the key in the rich text style when a geom needs to be displayed in a legend. It is designed to be provided to a layer's key_glyph argument, either as a function or as key_glyph = "richtext".

Usage

draw_key_richtext(data, params, size)

Value

A richtext_grob that represents formatted text.

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.

Examples

Run this code
library(ggplot2)

ggplot(mtcars, aes(wt, mpg, label = rownames(mtcars))) +
  geom_richtext(aes(colour = factor(cyl)), key_glyph = "richtext")

Run the code above in your browser using DataLab