Created
December 6, 2018 06:20
-
-
Save MattSandy/4a86981962f1d7e6ad123d4ae55c17ce to your computer and use it in GitHub Desktop.
Christmas Tree
This file contains hidden or 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
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