knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "readme_figures/README-"
)
library(fractalplotr)

fractalplotr

This package lets you create and plot fractals.

currently implemented:

Installation

You can install the most recent version from GitHub: ``` {r install, eval = FALSE}

install.packages("remotes")

remotes::install_github("bastihz/fractalplotr")

RStudio's integrated package updater won't detect updates in packages installed from GitHub. I recommend running
``` {r update, eval = FALSE}
remotes::update_packages()

in regular intervals to check for updates from those sources.

Examples

L-system plant

plant <- l_system(
    axiom = "X",
    rules = list(
        X = "F+[[X]-X]-F[-FX]+X",
        F = "FF"
    ),
    n = 7,
    angle = pi * 0.15,
    initial_angle = pi * 0.45
)
par(mar = rep(0, 4))
plot(plant, col = colorRampPalette(c("#008000", "#00FF00"))(100))

Dragon curve

d <- dragon_curve(12)
par(mar = rep(0, 4))
plot(d, col = "purple")

Mandelbrot set

blue_to_black <- colorRampPalette(c(rgb(0, 0, 0.5), "white", rgb(1, 0.75, 0), 
                                    "darkred", "black"))
m <- mandelbrot(
    1200, 
    1200,
    re_width = 2.5,
    center = -0.75,
    color_palette = blue_to_black(128),
    color_mode = "smooth"
)
plot(m)

Sandpile

s <- sandpile(1e5, c("white", "yellow", "orange", "red"))
plot(s)


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