spiral_text: Add texts to a track

View source: R/graphics.R

spiral_textR Documentation

Add texts to a track

Description

Add texts to a track

Usage

spiral_text(
  x,
  y,
  text,
  offset = NULL,
  gp = gpar(),
  facing = c("downward", "inside", "outside", "clockwise", "reverse_clockwise",
    "curved_inside", "curved_outside"),
  letter_spacing = 0,
  nice_facing = FALSE,
  just = "centre",
  hjust = NULL,
  vjust = NULL,
  track_index = current_track_index(),
  ...
)

Arguments

x

X-locations of the texts.

y

Y-locations of the texts.

text

A vector of texts.

offset

Radial offset of the text. The value should be a grid::unit() object.

gp

Graphical parameters.

facing

Facing of the text.

letter_spacing

Space between two letters. The value is a fraction of the width of current letter. It only works for curved texts.

nice_facing

If it is true, the facing will be automatically adjusted for texts which locate at different positions of the spiral. Note hjust and vjust will also be adjusted.

just

The justification of the text relative to (x, y). The same setting as in grid::grid.text().

hjust

Horizontal justification. Value should be numeric. 0 means the left of the text and 1 means the right of the text.

vjust

Vertical justification. Value should be numeric. 0 means the bottom of the text and 1 means the top of the text.

track_index

Index of the track.

...

Pass to grid::grid.text().

Details

For the curved text, it only supports one-line text.

Value

No value is returned.

Examples

x = seq(0.1, 0.9, length = 26)
text = strrep(letters, 6)
spiral_initialize(); spiral_track()
spiral_text(x, 0.5, text)

spiral_initialize(); spiral_track()
spiral_text(x, 0.5, text, facing = "inside")

spiral_initialize(); spiral_track()
spiral_text(x, 0.5, text, facing = "outside")

x = seq(0.1, 0.9, length = 10)
text = strrep(letters[1:10], 20)
spiral_initialize(); spiral_track()
spiral_text(x, 0.5, text, facing = "curved_inside")

spiral_initialize(); spiral_track()
spiral_text(x, 0.5, text, facing = "curved_outside")

jokergoo/spiralize documentation built on June 16, 2024, 4:35 a.m.