powered by
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 ggplot object containing the artwork.
ggplot
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.
Koen Derks, koen-derks@hotmail.com
https://mathworld.wolfram.com/RecamansSequence.html
colorPalette
# \donttest{ set.seed(1) # Simple example canvas_recaman(colors = colorPalette("tuscany1")) # }
Run the code above in your browser using DataLab