canvas_recaman {aRtsy} | R Documentation |
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
)
colors |
a string or character vector specifying the color(s) used for the artwork. |
background |
a character specifying the color used for the background. |
iterations |
the number of iterations of the algorithm. |
start |
the starting point of the algorithm. |
increment |
the increment of each step. |
curvature |
the curvature of each line. |
angle |
the angle at which to place the artwork. |
size |
the size of the lines. |
closed |
logical. Whether to plot a curve from the end of the sequence back to the starting point. |
A ggplot
object containing the artwork.
Koen Derks, koen-derks@hotmail.com
https://mathworld.wolfram.com/RecamansSequence.html
colorPalette
set.seed(1)
# Simple example
canvas_recaman(colors = colorPalette("tuscany1"))