Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
gongcastro committed Mar 13, 2024
1 parent 8be58d9 commit f15bde7
Show file tree
Hide file tree
Showing 49 changed files with 6,136 additions and 124 deletions.
100 changes: 0 additions & 100 deletions R/ambla.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,99 +83,6 @@ generate_aoa <- function(eli, threshold = 500, .by = NULL) {
}


# cumulative learning instances plot -------------------------------------------

generate_figure <- function(...) {
# simulate data ---------------
eli_df <- generate_eli(threshold = 500, ...) |>
dplyr::filter(!(hypothesis == "H1" & grepl("Non-cognate", te)))

aoa_df <- generate_aoa(eli_df, threshold = 500) |>
mutate(across(aoa, lst(min, max)), .by = c(te, language)) |>
dplyr::filter(!(hypothesis == "H1" & grepl("Non-cognate", te)))

img <- c(
cat = here::here("_assets", "img", "diagram-cat.png"),
dog = here::here("_assets", "img", "diagram-dog.png"),
) |>
purrr::map(magick::image_read) |>
purrr::map(\(x) magick::image_ggplot(x, interpolate = FALSE))

plot <- eli_df |>
ggplot(aes(age, eli,
colour = language,
linetype = hypothesis,
shape = hypothesis
)) +
geom_segment(
data = aoa_df,
aes(
x = aoa,
xend = aoa,
y = 0,
yend = threshold
),
linewidth = 3 / 4
) +
geom_hline(yintercept = aoa_df$threshold) +
geom_line(linewidth = 1) +
geom_point(
data = aoa_df,
stroke = 0.75,
aes(x = aoa, y = threshold),
size = 2.25
) +
labs(
x = "Age (months)",
y = "Learning instances",
colour = "Language (exposure)",
shape = "Hypothesis",
linetype = "Hypothesis"
) +
scale_y_continuous(labels = function(x) format(x, big.mark = ",")) +
theme_ggdist() +
theme(
panel.background = element_rect(fill = NA),
legend.key.width = unit(1.5, "cm"),
legend.position = "bottom",
legend.margin = margin(c(0, 0, 0, 0)),
legend.justification = c(0, 1),
legend.title = element_text(size = 9),
legend.text = element_text(size = 8),
strip.background = element_rect(fill = "grey90", colour = "grey90"),
strip.text = ggtext::element_markdown(),
panel.grid = element_blank(),
panel.grid.major.y = element_line(
colour = "grey",
linetype = "dotted"
),
panel.grid.minor.y = element_line(
colour = "grey",
linetype = "dotted"
)
) +
inset_element(img$cat,
on_top = FALSE, ignore_tag = TRUE,
left = -0.25, bottom = 0.50, right = 0.5, top = 1
) +
inset_element(img$dog,
on_top = FALSE, ignore_tag = TRUE,
left = 0.25, bottom = 0.50, right = 1, top = 1
) +
scale_x_continuous(breaks = seq(
min(eli_df$age),
max(eli_df$age), 4
)) +
theme(
panel.grid = element_blank(),
plot.background = element_rect(
fill = "white",
colour = NA
)
)
return(plot)
}

# ggplot theme
theme_ambla <- function() {
theme(
Expand Down Expand Up @@ -218,13 +125,6 @@ te_labels <- c(
"Cognate: /'gat/ (Catalan), /'ga.to/ (Spanish)"
)

img <- c(
cat = here::here("assets", "img", "diagram-cat.png"),
dog = here::here("assets", "img", "diagram-dog.png")
) |>
purrr::map(magick::image_read) |>
purrr::map(\(x) magick::image_ggplot(x, interpolate = FALSE))

# parameters
threshold <- 300
age_max <- 50
Expand Down
Binary file modified Rplots.pdf
Binary file not shown.
Binary file removed assets/gif/ambla-aoa-all.gif
Binary file not shown.
Binary file removed assets/gif/ambla-aoa-c.gif
Binary file not shown.
Binary file removed assets/gif/ambla-aoa-single-mon.gif
Binary file not shown.
Binary file removed assets/gif/ambla-aoa-single.gif
Binary file not shown.
Binary file modified assets/gif/ambla-eli-single-mon.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/gif/ambla-eli-single.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/gif/ambla-single-c.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/img/8m.png
Binary file not shown.
Binary file removed assets/img/allopenna-1.png
Binary file not shown.
Binary file removed assets/img/allopenna-2.png
Binary file not shown.
Binary file modified assets/img/ambla-all-c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/img/ambla-all-nc-mon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/img/ambla-all-nc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/img/ambla-single-nc-mon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/img/bergelson.jpg
Binary file not shown.
Binary file removed assets/img/cbc.jpg
Binary file not shown.
Binary file modified assets/img/cognate-proportion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/img/daniela.jpg
Binary file not shown.
Binary file removed assets/img/diagram-cat.png
Binary file not shown.
Binary file removed assets/img/diagram-dog.png
Binary file not shown.
Binary file removed assets/img/esrc-logo.png
Binary file not shown.
Binary file removed assets/img/irina.jpeg
Binary file not shown.
Binary file removed assets/img/kim.webp
Binary file not shown.
Binary file removed assets/img/logo-orcid.png
Binary file not shown.
Binary file removed assets/img/logo-twitter.png
Binary file not shown.
Binary file removed assets/img/mineco-logo.png
Binary file not shown.
Binary file removed assets/img/nicola.jpg
Diff not rendered.
Binary file removed assets/img/nuria.jpg
Diff not rendered.
Binary file removed assets/img/qr-code.png
Diff not rendered.
Binary file modified assets/img/s1-coefficients.png
Binary file modified assets/img/s1-convergence.png
Binary file modified assets/img/s1-predictions-comp.png
Binary file modified assets/img/s1-predictions-prod.png
Binary file modified assets/img/s2-1-convergence.png
Binary file modified assets/img/s2-1-predictions.png
Binary file modified assets/img/s2-2-convergence.png
Binary file modified assets/img/s2-2-predictions-bil.png
Binary file modified assets/img/s2-2-predictions-mon.png
Binary file removed assets/img/sap-1.jpg
Diff not rendered.
Binary file removed assets/img/sap-2.JPG
Diff not rendered.
Binary file removed assets/img/sap-3.JPG
Diff not rendered.
Binary file removed assets/img/serene.jpg
Diff not rendered.
Binary file modified assets/img/similarity.png
Binary file removed assets/img/uam.jpg
Diff not rendered.
Binary file modified assets/img/vocabulary.png
Binary file modified assets/img/wordbank.png
6,160 changes: 6,136 additions & 24 deletions index.html

Large diffs are not rendered by default.

0 comments on commit f15bde7

Please sign in to comment.