zerowidth_char: Create an HTML span of the unicode zero-width character

View source: R/ggplot2-annotations.R

zerowidth_charR Documentation

Create an HTML span of the unicode zero-width character

Description

Helper function for adjusting paragraph margins for use with ggtext/gridtext, which does not natively support margin/padding styles.

Usage

zerowidth_char(size = 12, units = "px")

Arguments

size

Size of the zero-width character

units

Defaults to "px"

Details

The zero-width unicode character only ever takes up vertical space, so when placed in-line its size determines the amount of "top-margins" for the paragraph. This allows finer control over spacing.

Value

A string

Examples

## Not run: 
library(ggtext)

ggplot() +
  geom_richtext(aes(0, 0, label = "This is a line<br><br>This is a paragraph<br>of text."))

ggplot() +
  geom_richtext(aes(0, 0, label = paste0(
    "This is a line<br>",
    zerowidth_char(30),
    "This is a paragraph<br>of text."
  )))

## End(Not run)

yjunechoe/penngradlings documentation built on Sept. 6, 2024, 8:13 p.m.