Skip to content

Instantly share code, notes, and snippets.

@MattSandy
Created December 6, 2018 06:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MattSandy/4a86981962f1d7e6ad123d4ae55c17ce to your computer and use it in GitHub Desktop.
Save MattSandy/4a86981962f1d7e6ad123d4ae55c17ce to your computer and use it in GitHub Desktop.
Christmas Tree
bulbs <- data.frame(x=c(300,500,650,400,600,500,450,500,500),y=(seq(100,600,60)/1.2))
s <- sample(0:1500)
r <- 0:500
mid <- 500
center <- rep(500,length(r))
tree <- data.frame(x = c(r,center,rev(r)+mid,center),
y = c(r,r+50,r,r+50),
g = c(s[r+1],s[r+1],s[r+mid*2],s[r+mid*2]))
ggplot(tree,aes(x=x,y=y)) +
geom_line(aes(group = g, colour = g),
alpha = .5, position = position_jitter(30,20)) +
geom_point(data=bulbs,color="red") +
scale_colour_gradient2(high = "#009900") +
theme(legend.position = "none")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment