Last active
July 21, 2025 16:54
-
-
Save USMortality/d737f3c3df24d76e61e0e01128104510 to your computer and use it in GitHub Desktop.
Population per Medal in the Olympic Games since 1896 [World]
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(readr) | |
library(ggplot2) | |
library(scales) | |
library(dplyr) | |
sf <- 2 | |
width <- 600 * sf | |
height <- 335 * sf | |
options(vsc.dev.args = list(width = width, height = height, res = 72 * sf)) | |
df <- read_csv( | |
"https://apify.mortality.watch/olympics-medals.csv" | |
) | |
de <- df |> filter(country == "Germany") | |
mean(de$population_per_medal) | |
median(de$population_per_medal) | |
chart <- df |> | |
filter(country %in% c( | |
"Germany", "United States", "China", "Great Britain", "France" | |
)) |> | |
ggplot(aes(x = year, y = population_per_medal, color = country)) + | |
geom_line() + | |
labs( | |
x = "Year", y = "Population per Medal", | |
title = "Population per Medal in the Olympic Games", | |
subtitle = "Source: medalspercapita.com" | |
) + | |
scale_y_log10(labels = label_number(accuracy = 1)) | |
ggplot2::ggsave( | |
filename = "chart1.png", plot = chart, width = width, height = height, | |
units = "px", dpi = 72 * sf, device = grDevices::png, type = c("cairo") | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://www.mortality.watch/charts/list.html#population-per-medal-in-the-olympic-games-since-1896-world