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.
canvas_strokes(
colors,
neighbors = 1,
p = 0.01,
iterations = 1,
resolution = 500,
side = FALSE
)
a string or character vector specifying the color(s) used for the artwork.
a positive integer specifying the number of neighbors a block considers when taking over a color. More neighbors fades the artwork.
a value specifying the probability of selecting a new color at each block. A higher probability adds more noise to the artwork.
a positive integer specifying the number of iterations of the algorithm. More iterations generally apply more fade to the artwork.
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.
logical. Whether to put the artwork on its side.
A ggplot
object containing the artwork.
colorPalette
# \donttest{
set.seed(1)
# Simple example
canvas_strokes(colors = colorPalette("tuscany1"))
# }