Skip to content

Instantly share code, notes, and snippets.

@marcusvolz
Created March 24, 2020 08:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save marcusvolz/28881fe048778b89a3a2f465c731ed94 to your computer and use it in GitHub Desktop.
Save marcusvolz/28881fe048778b89a3a2f465c731ed94 to your computer and use it in GitHub Desktop.
Interpolate squares
# Load packages
library(generative) # devtools::install_github("marcusvolz/generative")
library(ggplot2)
# Generate data (see generative::interpolate_squares documentation for details)
df <- interpolate_squares(seed = 1, n = 25, ease_function = "")
# Create plot
p <- ggplot() +
geom_segment(aes(x, y, xend = xend, yend = yend), df, alpha = 0.03,
size = 0.15, lineend = "round") +
facet_wrap(~id, scales = "free") +
theme_blankcanvas(margin_cm = 2.5)
# Save plot
ggsave("interpolate_squares.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