This function draws Recaman's sequence on a canvas. The algorithm takes increasingly large steps backward on the positive number line, but if it is unable to it takes a step forward.
canvas_recaman(
colors,
background = "#fafafa",
iterations = 100,
start = 0,
increment = 1,
curvature = 1,
angle = 0,
size = 0.1,
closed = FALSE
)
a string or character vector specifying the color(s) used for the artwork.
a character specifying the color used for the background.
the number of iterations of the algorithm.
the starting point of the algorithm.
the increment of each step.
the curvature of each line.
the angle at which to place the artwork.
the size of the lines.
logical. Whether to plot a curve from the end of the sequence back to the starting point.
A ggplot
object containing the artwork.
colorPalette
# \donttest{
set.seed(1)
# Simple example
canvas_recaman(colors = colorPalette("tuscany1"))
# }