Intro Thoughts
Status Quo
library(tidyverse)
options(scipen = 10)
library(marquee)
gapminder::gapminder |>
filter(year == 2002) |>
ggplot() +
aes(x = gdpPercap,
y = lifeExp) +
geom_point() +
scale_x_log10(labels = function(x) {paste0("$", x) |> str_replace("000$", "k")}) +
scale_y_continuous(labels = function(x) {paste0(x, rep("y", length(x) - 1) |> c(" year life \nexpectancy"))}) +
aes(size = pop/1000000) + labs(size = "Population \n(millions)") +
aes(color = continent) + labs(color = NULL)

gapminder::gapminder |>
ggplot() +
aes(x = year,
y = lifeExp,
group = country) +
geom_line() +
scale_x_continuous(labels = function(x) {str_replace(x, "\\d{2}", "'")}) +
scale_y_continuous(labels =
function(x) {paste0(x, rep("y", length(x) - 1) |> c("-year life \nexpectancy"))})

Experiment