This function draws a cobweb on the canvas. The cobweb consists of many Fibonacci spirals shifted by random noise from a normal distribution. A Fibonacci spiral is a logarithmic spiral that is derived from the Fibonacci sequence, a mathematical sequence where each number is the sum of the two preceding ones. The spiral is created by connecting the corners of squares that are sized according to the Fibonacci sequence. Specifically, if we draw a sequence of squares with side lengths of 1, 1, 2, 3, 5, 8, 13, and so on, each square can be arranged so that it is tangent to the previous square at a corner. When we connect these corners with a smooth curve, the resulting shape is the Fibonacci spiral.
canvas_cobweb(
colors,
background = "#fafafa",
lines = 300,
iterations = 100
)
A ggplot
object containing the artwork.
colorPalette
# \donttest{
set.seed(1)
# Simple example
canvas_cobweb(colors = colorPalette("neon1"), background = "black")
# }