chaos_fern: Chaos Fern

Description Usage Arguments Details References Examples

View source: R/chaos_game.R

Description

Create a fractal that resembles a fern.

Usage

1
2
3
4
chaos_fern(
  params = c("barnsley", "thelypteridaceae", "leptosporangiate"),
  iterations = 10000
)

Arguments

params

Either the name of a builtin parameter set (see details) or a data fram with the columns a, b, c, d, e and p.

iterations

The number of iterations.

Details

The builtin parameter sets are "barnsley", "thelypteridaceae" and "leptosporangiate". The names can be abbreviated. The barnsley fern is the one shown in the video. The two others are taken from the examples on wikipedia.

References

The Numberphile video featuring Ben Sparks and Brady Haran: Chaos Game (skip to 5:38).

Examples

1
2
3
4
5
6
7
8
9
ferns <- list(
    chaos_fern(iterations = 30000),
    chaos_fern("thelypteridaceae", iterations = 30000),
    chaos_fern("leptosporangiate", iterations = 30000)
)
par(mfrow = c(1, 3), mar = rep(0, 4))
for (fern in ferns) {
    plot(fern, pch = ".", axes = FALSE, ann = FALSE, asp = 1, col = "forestgreen")
}

BastiHz/numberphile documentation built on Oct. 12, 2020, 6:03 p.m.