Last active
January 4, 2018 14:19
-
-
Save ikashnitsky/657ddd6494dca6ddd23e7564234a5ff5 to your computer and use it in GitHub Desktop.
generate some simple snow -- https://twitter.com/ikashnitsky/status/937786580231696384
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
################################################################################ | |
# | |
# ikashnitsky.github.io 2017-12-04 | |
# Generate some snow for Sophia | |
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com | |
# | |
################################################################################ | |
library(tidyverse) | |
n <- 1e2 | |
tibble(x = runif(n), | |
y = runif(n), | |
size = runif(n, min = 4, max = 20)) %>% | |
ggplot(aes(x, y, size = size)) + | |
geom_point(color = "white", pch = 42)+ | |
scale_size_identity()+ | |
coord_cartesian(c(0, 1), c(0, 1))+ | |
theme_void()+ | |
theme(panel.background = element_rect(fill = "black"), | |
plot.background = element_rect(fill = "black")) | |
# generate bubbles of random color and size ------------------------------- | |
n <- sample(20:50, 1) | |
tibble(x = runif(n), | |
y = runif(n), | |
size = runif(n, min = 3, max = 20), | |
color = rgb(runif(n),runif(n),runif(n))) %>% | |
ggplot(aes(x, y, size = size, color = color)) + | |
geom_point()+ | |
scale_color_identity()+ | |
scale_size_identity()+ | |
coord_cartesian(c(0,1),c(0,1))+ | |
theme_void() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment