Intro Thoughts
Status Quo
library(tidyverse)
tt_pi_object <- tidytuesdayR::tt_load("2026-03-24")
## ---- Compiling #TidyTuesday Information for 2026-03-24 ----
## --- There is 1 file available ---
##
##
## ── Downloading files ───────────────────────────────────────────────────────────
##
## 1 of 1: "pi_digits.csv"
pi_df_16 <- tt_pi_object$pi_digits[1:33,]
digit_vec <- tt_pi_object$pi_digits$digit[1:33]
# The result is a list where each element is a vector prefix
list_of_prefixes <- lapply(1:33, function(i) digit_vec[1:i])
# Print the result
print(list_of_prefixes)
## [[1]]
## [1] 3
##
## [[2]]
## [1] 3 1
##
## [[3]]
## [1] 3 1 4
##
## [[4]]
## [1] 3 1 4 1
##
## [[5]]
## [1] 3 1 4 1 5
##
## [[6]]
## [1] 3 1 4 1 5 9
##
## [[7]]
## [1] 3 1 4 1 5 9 2
##
## [[8]]
## [1] 3 1 4 1 5 9 2 6
##
## [[9]]
## [1] 3 1 4 1 5 9 2 6 5
##
## [[10]]
## [1] 3 1 4 1 5 9 2 6 5 3
##
## [[11]]
## [1] 3 1 4 1 5 9 2 6 5 3 5
##
## [[12]]
## [1] 3 1 4 1 5 9 2 6 5 3 5 8
##
## [[13]]
## [1] 3 1 4 1 5 9 2 6 5 3 5 8 9
##
## [[14]]
## [1] 3 1 4 1 5 9 2 6 5 3 5 8 9 7
##
## [[15]]
## [1] 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9
##
## [[16]]
## [1] 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3
##
## [[17]]
## [1] 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2
##
## [[18]]
## [1] 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3
##
## [[19]]
## [1] 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8
##
## [[20]]
## [1] 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4
##
## [[21]]
## [1] 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6
##
## [[22]]
## [1] 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2
##
## [[23]]
## [1] 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6
##
## [[24]]
## [1] 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4
##
## [[25]]
## [1] 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3
##
## [[26]]
## [1] 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3
##
## [[27]]
## [1] 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8
##
## [[28]]
## [1] 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3
##
## [[29]]
## [1] 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2
##
## [[30]]
## [1] 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7
##
## [[31]]
## [1] 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9
##
## [[32]]
## [1] 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5
##
## [[33]]
## [1] 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0
pi_df_16$digit_history <- list_of_prefixes
library(RColorBrewer)
geom_pie <- make_constructor(GeomBar, stat = StatCount, position = "fill")
geom_pie_label <- make_constructor(GeomLabel, stat = StatCount,
position = position_fill(vjust = .5))
pi_df_16 |>
unnest(digit_history) |>
mutate(digit_position = paste0("Through ",
scales::label_ordinal()(digit_position), " digit") |>
fct_inorder()
) |>
ggplot() +
aes(y = "all",
group = digit_history |>
factor() |>
fct_inorder() |>
fct_rev(),
fill = digit_history |>
as_factor() ) +
geom_bar(position = "fill") +
coord_polar() +
facet_wrap(~ digit_position) +
scale_fill_discrete(breaks = unique(pi_df_16$digit),
palette = c(brewer.pal(9, "Blues"), scales:::col_mix("black", "midnightblue", .7)),
#colorRampPalette(c("white", "midnightblue"))(10)
) +
scale_color_manual(values = c("grey90", "midnightblue")) +
geom_label(stat = "count",
position = position_fill(vjust = .5),
size = 2.5,
aes(label = digit_history,
y = 1.25,
color = digit_history < 5),
show.legend = F,
linewidth = 0, fill = NA) +
labs(fill = "Digits in order\nof first\nappearance",
title = "From three ... to zero",
subtitle = "We're 33 digits in before we see all base-ten digits in pi... \n
3.14159265358979323846264338327950",
caption = "3.14159265358979323846264338327950") +
theme_void(paper = "oldlace", ink = scales:::col_mix("black", "midnightblue", .7),
base_size = 12) +
theme(plot.margin = margin(70,80,70,80),
plot.title.position = "plot",
legend.position = "none", #c(-.1,.8)
)

digit_vec |> paste(collapse = "")
## [1] "314159265358979323846264338327950"
Experiment
tt_pi_object$pi_digits |>
ggplot() +
aes(x = digit |> as.character()) +
geom_bar()

library(scales)
##
## Attaching package: 'scales'
## The following object is masked from 'package:purrr':
##
## discard
## The following object is masked from 'package:readr':
##
## col_factor
demo_continuous(c(1, 10))
## scale_x_continuous()

demo_continuous(c(1, 10), labels = label_ordinal())
## scale_x_continuous(labels = label_ordinal())

demo_continuous(c(1, 10),
labels = label_ordinal(),
breaks = breaks_width(2))
## scale_x_continuous(labels = label_ordinal(), breaks = breaks_width(2))

label_ordinal(1:10)
## function (x)
## {
## ordinal(x, prefix = prefix, suffix = suffix, big.mark = big.mark,
## rules = rules, ...)
## }
## <bytecode: 0x122928c70>
## <environment: 0x157c97d60>