Last active
September 23, 2020 01:04
-
-
Save MattSandy/7b48568f37d7069adc9313fff9b67865 to your computer and use it in GitHub Desktop.
Vaporwave R Plot
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
library(tidyverse) | |
theme_vapor = function(base_size = 12, base_family = "") { | |
theme_grey(base_size = base_size, base_family = base_family) %+replace% | |
theme( | |
# Specify axis options | |
axis.line = element_blank(), | |
axis.text.x = element_text(size = base_size*0.8, color = "white", lineheight = 0.9), | |
axis.text.y = element_text(size = base_size*0.8, color = "white", lineheight = 0.9), | |
axis.ticks = element_line(color = "white", size = 0.2), | |
axis.title.x = element_text(size = base_size, color = "white", margin = margin(0, 10, 0, 0)), | |
axis.title.y = element_text(size = base_size, color = "white", angle = 90, margin = margin(0, 10, 0, 0)), | |
axis.ticks.length = unit(0.3, "lines"), | |
# Specify legend options | |
legend.background = element_rect(color = NA, fill = "#212747"), | |
legend.key = element_rect(color = "white", fill = "#212747"), | |
legend.key.size = unit(1.2, "lines"), | |
legend.key.height = NULL, | |
legend.key.width = NULL, | |
legend.text = element_text(size = base_size*0.8, color = "white"), | |
legend.title = element_blank(), | |
legend.position = "bottom", | |
legend.text.align = NULL, | |
legend.title.align = NULL, | |
legend.direction = "horizontal", | |
legend.box = NULL, | |
# Specify panel options | |
panel.background = element_rect(fill = "#212747", color = NA), | |
panel.border = element_rect(fill = NA, color = "white"), | |
panel.grid.major = element_line(color = "#2a325b"), | |
panel.grid.minor = element_line(color = "#2a325b"), | |
panel.spacing = unit(0.5, "lines"), | |
# Specify facetting options | |
strip.background = element_rect(fill = "grey30", color = "grey10"), | |
strip.text.x = element_text(size = base_size*0.8, color = "white"), | |
strip.text.y = element_text(size = base_size*0.8, color = "white",angle = -90), | |
# Specify plot options | |
plot.background = element_rect(color = "#212747", fill = "#212747"), | |
plot.title = element_text(hjust = 0, size = rel(1.5), face = "bold", color = "white"), | |
plot.subtitle = element_text(hjust = 0, size = rel(1), face = "plain", color = "white"), | |
plot.caption = element_text(hjust = 1, size = rel(1), face = "plain", color = "white"), | |
plot.margin = unit(rep(1, 4), "lines") | |
) | |
} | |
df <- data.frame(x = rep(0:6,2), | |
y = c(1,3,9,5,2,1,1, | |
4,5,5,7,9,8,6), | |
z = rep("blue",7) %>% append(rep("pink",7))) | |
ggplot(df,aes(x = x, y = y, | |
group = z)) + | |
geom_area(fill = "#fe3abc", alpha=0.1, data = df %>% filter(z=="pink")) + | |
geom_area(fill = "#05f9ff", alpha=0.1, data = df %>% filter(z=="blue")) + | |
geom_line(color = "#fe3abc", alpha=0.1, size= 4, data = df %>% filter(z=="pink")) + | |
geom_line(color = "#fe3abc", alpha=0.1, size= 3, data = df %>% filter(z=="pink")) + | |
geom_line(color = "#fe3abc", alpha=0.2, size= 2, data = df %>% filter(z=="pink")) + | |
geom_line(color = "#fe3abc", alpha=.2, size= 1, data = df %>% filter(z=="pink")) + | |
geom_line(color = "#fe3abc", alpha=1, size= .5, data = df %>% filter(z=="pink")) + | |
geom_line(color = "#05f9ff", alpha=0.1, size= 4, data = df %>% filter(z=="blue")) + | |
geom_line(color = "#05f9ff", alpha=0.1, size= 3, data = df %>% filter(z=="blue")) + | |
geom_line(color = "#05f9ff", alpha=0.2, size= 2, data = df %>% filter(z=="blue")) + | |
geom_line(color = "#05f9ff", alpha=.2, size= 1, data = df %>% filter(z=="blue")) + | |
geom_line(color = "#05f9ff", alpha=1, size= .5, data = df %>% filter(z=="blue")) + | |
geom_point(aes(color = z),size = 3) + | |
scale_color_manual(values = c("#05f9ff", "#fe3abc")) + | |
scale_x_continuous(breaks = seq(0,6,1), expand = c(0, 0)) + | |
scale_y_continuous(breaks = seq(0,10,2), expand = c(0, 0)) + | |
theme_vapor() | |
ggsave("Rplot.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment