Skip to content

Instantly share code, notes, and snippets.

@ikashnitsky
Last active January 4, 2018 14:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikashnitsky/657ddd6494dca6ddd23e7564234a5ff5 to your computer and use it in GitHub Desktop.
Save ikashnitsky/657ddd6494dca6ddd23e7564234a5ff5 to your computer and use it in GitHub Desktop.
################################################################################
#
# 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