Skip to content

Instantly share code, notes, and snippets.

@davidski
Created February 13, 2015 13:43
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 davidski/82f0e67cad445c98fffa to your computer and use it in GitHub Desktop.
Save davidski/82f0e67cad445c98fffa to your computer and use it in GitHub Desktop.
Triskaidekaphillia
library(dplyr)
# thanks to http://www.math-aids.com/ for the shape points
shape1 <- list(c(0,0), c(1,-1.5), c(1.5,-3), c(2,-5), c(2,-6), c(1.5,-7), c(3,-7.5), c(4,-7.5), c(5.5,-7), c(5,-6.5),
c(3,-6), c(3,-5), c(4,-2.5), c(5,-1), c(6,0), c(7,1), c(8.5,2), c(10,2.5), c(11,3), c(10,3.5),
c(9,4.5), c(9.5,6.5), c(8,5), c(6,5), c(5,5.5), c(4,7), c(3.5,4), c(2.5,3.5), c(4,2), c(3,1.5),
c(2,2.5), c(1.5,4), c(1,6), c(0,7), c(-2,7.5), c(-4,7), c(-5,6.5), c(-6,5), c(-7,4), c(-7.5,3.5),
c(-8.5,4), c(-8.5,9), c(-9.5,10), c(-11,10.5), c(-13,10), c(-14,9), c(-13.5,8), c(-13,7.5), c(-11.5,8),
c(-10,4.5), c(-9,2), c(-8,0), c(-7,-2.5), c(-6.5,-5), c(-5.5,-6), c(-4.5,-7.5), c(-1.5,-7.5),
c(-1.5,-6.5), c(-2.5,-6), c(-4,-6.5), c(-5,-5), c(-5,-3), c(-4.5,-1), c(-3,.5), c(-1,.5), c(0,0))
shapedat <- data.frame(matrix(unlist(shape1), nrow=66, byrow=T))
shapedat$shape <- "shape1"
dat <- shapedat
shape2 <- list(c(6,3) , c(6.5,3), c(6,4) , c(4.5,4.5) , c(5,3.5) , c(6,3))
shapedat <- data.frame(matrix(unlist(shape2), nrow=6, byrow=T))
shapedat$shape <- "shape2"
dat <- rbind(dat, shapedat)
shape3 <- list(c(7,3), c(8.5,3), c(9,3.5), c(8,4), c(7,3))
shapedat <- data.frame(matrix(unlist(shape3), nrow=5, byrow=T))
shapedat$shape <- "shape3"
dat <- rbind(dat, shapedat)
library(ggplot2)
gg <- ggplot(dat, aes(X1, X2), fill="black")
gg <- gg + geom_polygon()
gg <- gg + coord_equal()
gg <- gg + theme_minimal()
gg <- gg + theme(axis.text=element_blank())
gg <- gg + theme(axis.ticks=element_blank())
gg <- gg + theme(panel.grid=element_blank())
gg <- gg + theme(axis.title.x = element_blank())
gg <- gg + theme(axis.title.y = element_blank())
gg <- gg + ggtitle("Happy Friday the 13th!")
gg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment