plot.l_system: Plot L-systems

Description Usage Arguments Value Examples

View source: R/l_system.R

Description

Plot L-systems as line segments.

Usage

1
2
## S3 method for class 'l_system'
plot(x, ...)

Arguments

x

A data frame of class "l_system" as returned from l_system() with the columns x0, y0, x1, and y1.

...

Other parameters passed on to graphics::segments().

Value

None

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
l_tree <- l_system(
    axiom = "X",
    rules = list(X = "F[+@.7X]F![-@.6X]F"),
    n = 10,
    angle = radians(22.5),
    extra_info = TRUE
)
# using the extra_info argument to vary color and line thickness:
plot(
    l_tree,
    col = ifelse(l_tree$depth < 6, "sienna", "forestgreen"),
    lwd = l_tree$depth / max(l_tree$depth) * -2 + 3
)

BastiHz/fractalplotr documentation built on Sept. 9, 2021, 4:46 a.m.