Intro Thoughts
Status Quo
library(tidyverse)
library(tidyverse)
pkgs <- as_tibble(tools::CRAN_package_db())
gg_pkgs <- pkgs %>%
select(Package, Depends, Imports, Suggests) %>%
filter(
str_detect(Package, "^gg|^GG"),
if_any(-Package, ~ str_detect(.x, "ggplot2"))
) %>%
mutate(
dep_grid = str_detect(Depends, "\\bgrid\\b") | str_detect(Imports, "\\bgrid\\b"),
dep_dplyr = str_detect(Depends, "\\bdplyr\\b") | str_detect(Imports, "\\bdplyr\\b")
) %>%
drop_na() %>%
mutate(type = case_when(dep_grid&dep_dplyr ~ "both",
dep_grid ~ "grid",
dep_dplyr ~ "dplyr",
TRUE ~ "neither"))
GeomText$default_aes
## Aesthetic mapping:
## * `colour` -> `from_theme(ink)`
## * `family` -> `from_theme(family)`
## * `size` -> `from_theme(fontsize)`
## * `angle` -> 0
## * `hjust` -> 0.5
## * `vjust` -> 0.5
## * `alpha` -> NA
## * `fontface` -> 1
## * `lineheight` -> 1.2
gg_pkgs %>%
mutate(type = factor(type, c("dplyr", "grid", "both", "neither"))) %>%
ggplot() +
facet_wrap(facets = vars(type), nrow = 2) +
aes(label = Package) +
ggtextcircle::geom_textcircle(hjust = 0, r = 4, size = 3) +
coord_fixed() +
geom_text(data = . %>% distinct(type), x = 0, y = 0, size = 12, font.face = "bold",
aes(label = type)) +
aes(color = type) +
scale_color_manual(values = c( "magenta", "darkolivegreen","grey", "grey")) +
# theme(geom = element_geom(ink = "lightyellow", accent = "red")) +
theme_void() +
theme(legend.position = "none",
strip.background = element_blank(),
strip.text.x = element_blank())
## Warning in geom_text(data = . %>% distinct(type), x = 0, y = 0, size = 12, :
## Ignoring unknown parameters: `font.face`

Experiment
"https://raw.githubusercontent.com/EvaMaeRey/mytidytuesday/refs/heads/main/2024-11-19-gg-prefixes/exported_funs_exts_ggplot2_tidyverse_org.csv" |>
read_csv() |>
mutate(prefix = fun_exported %>% str_extract(".*?_")) %>%
filter(n() >= 20, .by = prefix) %>%
filter(!is.na(prefix)) %>%
ggplot() +
aes(label = fun_exported) +
ggtextcircle::geom_textcircle(hjust = 0) +
# ggtextcircle::geom_textcircle(hjust = 1, aes(label = repo)) +
facet_wrap(~prefix) +
coord_equal() +
geom_text(data = . %>% distinct(prefix), x = 0, y = 0, size = 12, font.face = "bold",
aes(label = prefix))
## Rows: 5527 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (3): user, repo, fun_exported
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
## Warning in geom_text(data = . %>% distinct(prefix), x = 0, y = 0, size = 12, :
## Ignoring unknown parameters: `font.face`
![]()