Skip to content

Instantly share code, notes, and snippets.

@marcusvolz
Last active June 28, 2021 16:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcusvolz/69b38feb9908aa3a80ff6df77c7e00bd to your computer and use it in GitHub Desktop.
Save marcusvolz/69b38feb9908aa3a80ff6df77c7e00bd to your computer and use it in GitHub Desktop.
Procedural ring
# Load packages
library(generative) # devtools::install_github("marcusvolz/generative")
library(ggplot2)
# Set parameters (see generative::procedural_ring documentation for details)
seed <- 3
n <- 400
n_circles <- 4
r_0 <- 500
eps <- 500
eps_big <- 5000
p_defect <- 0.1
delta <- 2.02
# Generate data
df <- procedural_ring(seed, n, n_circles, r_0, eps, eps_big, p_defect, delta)
# Create plot
p <- ggplot() +
geom_segment(aes(x, y, xend = xend, yend = yend), df, size = 0.025, alpha = 0.05) +
coord_equal() +
theme_void()
# Save plot (might take a while)
ggsave("procedural_ring.png", p, width = 20, height = 20, units = "cm")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment