canvas_squares {aRtsy}R Documentation

Draw Squares and Rectangles

Description

This function paints random squares and rectangles. It works by repeatedly cutting into the canvas at random locations and coloring the area that these cuts create.

Usage

canvas_squares(
  colors,
  background = "#000000",
  cuts = 50,
  ratio = 1.618,
  resolution = 200,
  noise = FALSE
)

Arguments

colors

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

background

a character specifying the color used for the borders of the squares.

cuts

a positive integer specifying the number of cuts to make.

ratio

a value specifying the 1:1 ratio for each cut.

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.

noise

logical. Whether to add k-nn noise to the artwork. Note that adding noise increases computation time significantly in large dimensions.

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_squares(colors = colorPalette("retro2"))



[Package aRtsy version 0.2.4 Index]