canvas_strokes: Draw Strokes

View source: R/canvas_strokes.R

canvas_strokesR Documentation

Draw Strokes

Description

This function creates an artwork that resembles paints strokes. The algorithm is based on the simple idea that each next point on the grid has a chance to take over the color of an adjacent colored point but also has a change of generating a new color.

Usage

canvas_strokes(
  colors,
  neighbors = 1,
  p = 0.01,
  iterations = 1,
  resolution = 500,
  side = FALSE
)

Arguments

colors

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

neighbors

a positive integer specifying the number of neighbors a block considers when taking over a color. More neighbors fades the artwork.

p

a value specifying the probability of selecting a new color at each block. A higher probability adds more noise to the artwork.

iterations

a positive integer specifying the number of iterations of the algorithm. More iterations generally apply more fade to the artwork.

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.

side

logical. Whether to put the artwork on its side.

Value

A ggplot object containing the artwork.

Author(s)

Koen Derks, koen-derks@hotmail.com

See Also

colorPalette

Examples


set.seed(1)

# Simple example
canvas_strokes(colors = colorPalette("tuscany1"))



aRtsy documentation built on Aug. 21, 2023, 9:08 a.m.