This function uses a space colony algorithm to draw Petri dish colonies.

canvas_petri(
  colors,
  background = "#fafafa",
  dish = "black",
  attractors = 1000,
  iterations = 15,
  hole = 0
)

Arguments

colors

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

background

a character specifying the color used for the background (and the hole).

dish

a character specifying the color used for the Petri dish.

attractors

an integer specifying the number of attractors.

iterations

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

hole

a value between 0 and 0.9 specifying the hole size in proportion to the dish.

Value

A ggplot object containing the artwork.

See also

colorPalette

Author

Koen Derks, koen-derks@hotmail.com

Examples

# \donttest{
set.seed(2)

# Simple example
canvas_petri(colors = colorPalette("origami"))


# Advanced example
canvas_petri(colors = "white", hole = 0.8, attractors = 5000)

# }