Plotting points in the pattern of Sunflower seeds
# load packages
pacman::p_load(pacman,tidyverse,GGally,ggthemes,ggplot2,ggvis,httr,plotly,rio,rmarkdown,shiny)
# Number of seeds (points) to plot - The average sunflower has around 1,000 to 2,000 seeds
s <- 1500 # Alter s to increase or decrease number of seeds in the plot
# Golden angle in radians
golden_angle <- pi * (3 - sqrt(5))
# Create seed positions using the golden angle
theta <- golden_angle * (1:s)
r <- sqrt(1:s)
# Convert polar coordinates to Cartesian coordinates
x <- r * cos(theta)
y <- r * sin(theta)
# Create data frame
df <- data.frame(x, y)
# Plot the seeds using ggplot2
ggplot(df, aes(x, y)) +
geom_point(shape = 21, color = "black", fill = "yellow", size = 2) +
theme_void() +
coord_fixed(ratio = 1)
