Skip to contents

Draw multiple curves

Usage

draw_multiple_curves(
  ...,
  list = NULL,
  nrow = NULL,
  ncol = NULL,
  extend = TRUE,
  title = FALSE,
  closed = FALSE,
  padding = unit(0, "pt"),
  lwd = 4,
  col = NULL
)

Arguments

...

A list of sfc_sequence objects or objects in its child classes, a list of grid::grob objects or a list of two-column coordinate matrices, i.e., all the forms that can represent curves in this package.

list

The list of curve object can also be directly specified as a "list" object.

nrow

Number of rows in the layout.

ncol

Number of columns in the layout.

extend

Whether to draw the entry and exit segments? It is only used when input is a list of sfc_sequence objects.

title

Whether to add titles on each panel? The title is constructed in the form of initial_seed|expansion_codes, e.g. I|111. The value can be a vector of user-defined strings.

closed

Whether the curves are closed? The value should be a logical vector. If it is TRUE, the last point is connected to the first point in the curve to form a closed curve. Length of closed can be 1 or the number of curves.

padding

Space around each curve. The value should be a grid::unit object with length 1.

lwd

Line width with length 1.

col

Color for the segments with length 1. If the value is NULL, it uses the "Spectral" color palettes from the RColorBrewer package.

Details

This function is used for quick comparison on curves.

Examples

# for all forms of curves initialized by base pattern 'R', with rotation 0, and on level 3
draw_multiple_curves(
    sfc_2x2("R", "111"),
    sfc_2x2("R", "112"),
    sfc_2x2("R", "121"),
    sfc_2x2("R", "122"),
    sfc_2x2("R", "211"),
    sfc_2x2("R", "212"),
    sfc_2x2("R", "221"),
    sfc_2x2("R", "222"),
    nrow = 2, title = TRUE)


# simply a list of sequences
# note they only contain I/R/L, so the base patterns I/R/L are internally used
draw_multiple_curves(
    sfc_sequence("IIII"),
    sfc_sequence("RRRR"),
    sfc_sequence("RRLL"),
    nrow = 1
)