Created
April 5, 2020 10:28
-
-
Save marcusvolz/7ed603a138bc1ede6a71330c177d9780 to your computer and use it in GitHub Desktop.
Wildflowers
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) | |
for (i in c(3, 86, 111)) { | |
# Set parameters | |
seed <- i | |
set.seed(seed) | |
n <- 400 | |
n_circles <- 4 # 4 | |
r_0 <- runif(1, 0.1*500, 1.5*500) # 500 | |
eps <- runif(1, 0.1*500, 1.5*500) # 500/2 | |
eps_min <- 0 | |
eps_big <- eps * (runif(1, 0, 10)) # 2500/2 # 5000 | |
p_defect <- runif(1, 0, 0.35) # 0.05 # | |
delta <- runif(1, 0.1, 3) # 2.02/2 | |
wildflower <- TRUE | |
# Generate data | |
df <- procedural_ring(seed, n, n_circles, r_0, eps, eps_big, p_defect, delta, wildflower) | |
# 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 | |
ggsave(paste0("plot_", sprintf("%03.0f", i), ".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