Skip to content

Instantly share code, notes, and snippets.

@yjunechoe
Created April 6, 2021 03:15
Show Gist options
  • Select an option

  • Save yjunechoe/a6aeeb6a868d9152c0ac611cb41dcbb0 to your computer and use it in GitHub Desktop.

Select an option

Save yjunechoe/a6aeeb6a868d9152c0ac611cb41dcbb0 to your computer and use it in GitHub Desktop.
library(ggplot2)
library(dplyr)
library(ragg)
tibble(x = 2019:2021, y = c(3764, 2520, 947)) %>%
ggplot(aes(x, y)) +
geom_line(
size = 2,
linetype = "53"
) +
shadowtext::geom_shadowtext(
aes(label = c("directions_run", "directions_walk", "airline_seat_recline_normal")),
size = 15,
family = "Material Icons",
color = "white",
bg.color = "black"
) +
geom_label(
aes(label = paste(y, "steps/day")),
position = position_nudge(y = -750),
family = "Roboto",
fontface = "bold",
label.size = 0
) +
geom_text(
aes(x = 2021.2, y = 947, label = "laptop"),
size = 15,
family = "Material Icons",
color = "black",
) +
geom_text(
aes(x = 2021.2, y = 947 + 20, label = "videocam"),
size = 5,
family = "Material Icons",
color = "black",
) +
scale_y_continuous(
limits = c(0, 4000),
expand = expansion(c(.1, .1)),
breaks = 0:4 * 1000
) +
scale_x_continuous(
expand = expansion(c(.15, .1)),
breaks = 2019:2021
) +
labs(
title = "Average steps per day between 2019 and 2021",
subtitle = "Slowly succumbing to pandemic fatigue",
x = NULL, y = NULL
) +
theme_classic() +
theme(
text = element_text(family = "Rubik"),
axis.line = element_blank(),
axis.ticks = element_blank(),
axis.text.x = element_text(size = 22, color = "black"),
axis.text.y = element_text(size = 16, color = "black"),
panel.grid.major.y = element_line(size = 1, linetype = 2),
plot.margin = margin(5, 5, 5, 5, "mm"),
plot.title.position = "plot",
plot.title = element_text(size = 22, family = "Roboto Mono", margin = margin(b = 3, unit = "mm")),
plot.subtitle = element_text(size = 18, family = "Futura Bk BT", margin = margin(b = 8, unit = "mm"))
)
@yjunechoe
Copy link
Copy Markdown
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment