Created
June 17, 2019 19:01
-
-
Save hypercompetent/87f9166878ffdb95198b82e53fa353b7 to your computer and use it in GitHub Desktop.
Generate a plot for the Allen Institute for Immunology logo
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
plot_logo <- function() { | |
library(ggplot2) | |
core_rect <- data.frame(xmin = 0, | |
xmax = 4, | |
ymin = 0, | |
ymax = 0.6, | |
color = "") | |
arc_rects <- data.frame(xmin = 0:3, | |
xmax = 1:4 - 0.02, | |
ymin = 0.65, | |
ymax = 2, | |
fill = c("darkolivegreen4", | |
"darkolivegreen4", | |
"midnightblue", | |
"darkolivegreen4")) | |
arc_segments <- data.frame(x = 0:3 + 0.5, | |
xend = 0:3 + 0.5, | |
y = 0.65, | |
yend = 1.3) | |
arc_points <- data.frame(x = 0:3 + 0.5, | |
y = 1.3, | |
fill = c("white","white","midnightblue","white")) | |
ggplot() + | |
geom_rect(data = core_rect, | |
aes(xmin = xmin, | |
xmax = xmax, | |
ymin = ymin, | |
ymax = ymax), | |
fill = "darkolivegreen4") + | |
geom_rect(data = arc_rects, | |
aes(xmin = xmin, | |
xmax = xmax, | |
ymin = ymin, | |
ymax = ymax, | |
fill = fill)) + | |
geom_segment(data = arc_segments, | |
aes(x = x, xend = xend, | |
y = y, yend = yend), | |
color = "white", | |
size = 2) + | |
geom_point(data = arc_points, | |
aes(x = x, | |
y = y), | |
color = "white", | |
size = 15) + | |
geom_point(data = arc_points, | |
aes(x = x, | |
y = y, | |
color = fill), | |
size = 12) + | |
scale_color_identity() + | |
scale_fill_identity() + | |
scale_x_continuous(limits = c(0, 4)) + | |
coord_polar(start = pi/4) + | |
theme_void() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment