├── life_in_months.png ├── life in months + annotations.png ├── README.md ├── life_chart.Rproj └── life_chart.R /life_in_months.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/isabellabenabaye/life-chart/HEAD/life_in_months.png -------------------------------------------------------------------------------- /life in months + annotations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/isabellabenabaye/life-chart/HEAD/life in months + annotations.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # My Life in Months 2 | 3 | A waffle chart of each month in my life until age 70. Blog post: https://isabella-b.com/blog/my-life-in-months/ 4 | 5 | ![](https://github.com/isabellabenabaye/life-chart/blob/main/life%20in%20months%20+%20annotations.png?raw=true) -------------------------------------------------------------------------------- /life_chart.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | -------------------------------------------------------------------------------- /life_chart.R: -------------------------------------------------------------------------------- 1 | library(tidyverse) 2 | library(lubridate) 3 | library(waffle) 4 | library(hrbrthemes) 5 | library(extrafont) 6 | loadfonts(device = "win", quiet = TRUE) 7 | 8 | # Create the data----- 9 | life_data <- 10 | tibble(months = factor(rep(month.abb[1:12], 72), levels=month.abb[1:12])) %>% ## make months 11 | slice(4:(n()-9)) %>% ## remove months in 1996 before my birth month (April) 12 | tibble( 13 | age = rep(0:70, each = 12) ## age range: 1-70 14 | ) %>% 15 | rowid_to_column("row_name") ## add column for row number 16 | 17 | ## add the "eras" to be colored in the waffle chart 18 | life_data <- life_data %>% 19 | mutate(era = fct_inorder(case_when(row_name < 161 ~ "Childhood - US", 20 | row_name < 207 ~ "High School - PH", 21 | row_name < 255 ~ "College - PH", 22 | row_name < 285 ~ "Adulting - PH", 23 | row_name < ((year(Sys.Date()) - 1996)*12) + (month(Sys.Date()) - 3) ~ "Adulting - US", ## months into "Adulting - US" based on current month 24 | TRUE ~ "Time left"))) 25 | 26 | # Waffle chart----- 27 | life_in_months <- life_data %>% 28 | count(era) %>% ## the count of each era is the number of months in that era 29 | ggplot(aes(fill = era, values = n)) + 30 | geom_waffle(color = "#F7F7F7", n_rows = 12, size = 1, flip = TRUE) + ## make each row a year/12 months 31 | scale_fill_manual(name = "", values = c("#EF476F","#FCA311","#FFD166","#0EAD69","#4ECDC4","#118AB2")) + ## assign colors to the eras 32 | coord_equal() + 33 | theme_ipsum(grid = "") + 34 | theme(legend.text = element_text(family = "Cooper Lt BT", size = 40), 35 | plot.background = element_rect(fill = "#F7F7F7", color = "#F7F7F7")) + 36 | theme_enhance_waffle() 37 | 38 | life_in_months 39 | 40 | # Save the chart 41 | life_in_months + ggsave("life_in_months.png", device = "png", type = "cairo", width = 15, height = 25, dpi = 300) 42 | --------------------------------------------------------------------------------