Description Usage Arguments Details References Examples
Create a fractal that resembles a fern.
1 2 3 4 | chaos_fern(
params = c("barnsley", "thelypteridaceae", "leptosporangiate"),
iterations = 10000
)
|
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. |
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.
The Numberphile video featuring Ben Sparks and Brady Haran: Chaos Game (skip to 5:38).
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")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.