Skip to content

Instantly share code, notes, and snippets.

@farach
Created August 12, 2021 20:12
Show Gist options
  • Select an option

  • Save farach/65e985d3ce3688a03ef7cac072349818 to your computer and use it in GitHub Desktop.

Select an option

Save farach/65e985d3ce3688a03ef7cac072349818 to your computer and use it in GitHub Desktop.
This is a tidyverse (ggplot) version of a George Savva plot
# ggplot version of https://mobile.twitter.com/georgemsavva/status/1419784944352702465
library(tidyverse)
gifski::save_gif(
lapply(seq(0, 1, l = 600), function(a) {
print(
data.frame(
b = 1 - a,
t = 3 * pi * (1:400) / 100
) %>%
mutate(
x = cos(a * t),
y = sin(b * t)^3
) %>%
ggplot(aes(x, y, size = sqrt(t) / 2)) +
geom_point(color = hsv(0.5, 1, t / max(t))) +
theme_void() +
theme(
panel.background = element_rect(fill = "black"),
plot.background = element_rect(fill = "black")
) +
lims(x = c(-1, 1), y = c(-1, 1))
)
}),
w = 600,
h = 600,
d = 1/30
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment