This function draws the Physarum polycephalum slime mold on a canvas. The algorithm simulates particles on a two-dimensional grid that move towards areas on the grid with a high intensity.

canvas_slime(
  colors,
  background = "#000000",
  iterations = 2000,
  agents = 1000,
  layout = c(
     "random", "gaussian", "circle", "grid",
     "clusters", "arrows", "wave", "spiral"
  ),
  resolution = 1000
)

Arguments

colors

a character (vector) specifying the color(s) used for the artwork.

background

a character specifying the color used for the background.

iterations

a positive integer specifying the number of iterations of the algorithm.

agents

a positive integer specifying the number of agents to use.

layout

a character specifying the initial layout of the agents. Possible options are random (default), gaussian, circle, grid, clusters, arrows and wave.

resolution

resolution of the artwork in pixels per row/column. Increasing the resolution increases the quality of the artwork but also increases the computation time exponentially.

Value

A ggplot object containing the artwork.

See also

colorPalette

Author

Koen Derks, koen-derks@hotmail.com

Examples

# \donttest{
set.seed(1)

# Simple example
canvas_slime(colors = colorPalette("neon1"))

# }