Plotting points in a spiral shape. Based on a logarithmic
spiral.
# Install packages
pacman::p_load(pacman,tidyverse,GGally,ggthemes,ggplot2,ggvis,httr,plotly,rio,rmarkdown,shiny)
# Define the Golden Ratio
phi <- (1 + sqrt(5)) / 2
# Define parameters
a <- 1
b <- log(phi) / pi
t <- 8 # Adjust the value of t, to increase or decrease the number of turns
theta <- seq(0, t*pi, by=0.01)
r <- a * exp(b * theta)
# Convert polar coordinates to Cartesian coordinates
x <- r * cos(theta)
y <- r * sin(theta)
# Plot the spiral
plot(x, y, type="l", lwd=2, col="goldenrod", xlim=c(-max(r), max(r)), ylim=c(-max(r), max(r)), asp=1, xlab="", ylab="", axes=FALSE)
# Highlight points to give the appearance of the nautilus (shell) chambers
points(x, y, col="goldenrod", cex=0.2, pch=16)
# Title chart
title("Golden Spiral")
