word | vowel | f1 | f2 |
---|---|---|---|
… | … | … | … |
blue | uː | 475 | 1740 |
… | … | … | … |
ggplot2
in R2025-05-18
(free posit cloud account necessary)
index.qmd
) and offline exercises:word | vowel | f1 | f2 |
---|---|---|---|
… | … | … | … |
blue | uː | 475 | 1740 |
… | … | … | … |
Ladefoged, Peter (1999). “American English”. Handbook of the International Phonetic Association. Cambridge: Cambridge University Press. pp. 41–44.
ggplot2
in vowels
and phonR
, not covered# A tibble: 41,667 × 6
speaker word f1 f2 vowel environment
<chr> <chr> <dbl> <dbl> <chr> <chr>
1 mass01 MOVED 332. 1286. uː elsewhere
2 mass01 YEAH 792. 1841. æ elsewhere
3 mass01 SCHOOL 450. 903. uː pre-l
4 mass01 WENT 580 1865. e <NA>
5 mass01 TO 418. 2268. uː elsewhere
6 mass01 ITS 456. 2149. ɪ <NA>
7 mass01 SCHOOL 419. 710. uː pre-l
8 mass01 AREA 585. 2056. e <NA>
9 mass01 DROVE 561 1310. oʊ elsewhere
10 mass01 YOUNG 674. 1528. ʌ <NA>
# ℹ 41,657 more rows
Prerequisites: (1) the Charis SIL font installed on your computer and (2) registered in R with extrafont::font_import()
vowel_means |>
mutate(vowel = factor(vowel,
levels = c(
"iː", "ɪ", "eɪ", "e", "æ", "ʌ", "ɑː", "ɔː", "oʊ", "ʊ", "uː"
))) |>
arrange(vowel) |>
ggplot(aes(mean_f2, mean_f1)) +
geom_path() +
geom_label(aes(label = vowel), family = "Charis SIL", size = 6) +
scale_x_reverse() +
scale_y_reverse(limits = c(800, 300))
geom_density_2d()
geom_density_2d()
stat_ellipsis()
vs geom_density_2d()
ggdensity::stat_hdr()
library(ggdensity)
ggplot(mass_small, aes(
f2, f1, fill = vowel)) +
stat_hdr(probs = c(0.7, 0.5, 0.2)) +
geom_text(data = vowel_means,
aes(x = mean_f2,
y = mean_f1,
label = vowel),
size = 6, col = "white",
family = "Charis SIL"
)+
scale_x_reverse() +
scale_y_reverse() +
theme(legend.position = 'none')
ggdensity::stat_hdr()
# A tibble: 5 × 8
speaker word vowel environment measurement_point f1 f2 token
<chr> <chr> <chr> <chr> <int> <dbl> <dbl> <int>
1 mass01 MOVED uː elsewhere 1 343. 1384. 1
2 mass01 MOVED uː elsewhere 2 343. 1384. 1
3 mass01 MOVED uː elsewhere 3 323. 1108. 1
4 mass01 MOVED uː elsewhere 4 331. 1156. 1
5 mass01 MOVED uː elsewhere 5 331. 1197. 1
environment
mass |>
filter(vowel == "uː") |>
ggplot(aes(x = measurement_point)) +
geom_path(aes(y = f1, group = token), alpha = 0.04, col = "pink") +
geom_path(aes(y = f2, group = token), alpha = 0.04, col = "skyblue") +
geom_smooth(aes(y = f1), col = "pink2", method = "loess",
linewidth = 1, se = FALSE) +
geom_smooth(aes(y = f2), col = "skyblue2", method = "loess",
linewidth = 1, se = FALSE) +
labs(y = "Hz") +
facet_wrap(~environment) +
theme(panel.grid.major.x = element_blank())
wide [waɪd]
white [wʌit]
Examples from: 🔗 University of Washington/Northwestern University Corpus
mass |>
filter(vowel == "aɪ") |>
group_by(environment, measurement_point) |>
reframe(mean_f1 = mean(f1, na.rm = TRUE),
mean_f2 = mean(f2, na.rm = TRUE)) |>
ggplot(aes(
x = measurement_point,
col = environment)) +
geom_path(aes(y = mean_f2), linewidth = 2) +
geom_path(aes(y = mean_f1), linewidth = 2) +
scale_color_manual(values = c("seagreen", "pink"))
Not shown, but applied throughout this presentation
ggsave()
✅(free posit cloud account necessary)
index.qmd
) and offline exercises: