Last active
June 28, 2021 16:28
-
-
Save marcusvolz/69b38feb9908aa3a80ff6df77c7e00bd to your computer and use it in GitHub Desktop.
Procedural ring
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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