79186549

Date: 2024-11-13 20:32:50
Score: 1
Natty:
Report link

I was able to get my use case to work, following these examples and tips from June Choe and Cara Thompson:

Using a combination of systemfonts::register_font() for the TTF I wanted to register and systemfonts::registry_fonts() to confirm it's existence, I could then load the font without impacting emoji rendering. Even can combine the two in the same plot:

df <- cars |>
  mutate(
    glyph = case_when(speed > 16 ~ "✅",
                      .default = fontawesome("fa-car")),
    label = case_when(speed > 16 ~ "Fast",
                      .default = "Slow"),
    color = case_when(speed > 16 ~ "red",
                      .default = "green")
  ) |>
  tibble::tibble()

ggplot() +
  geom_swim_marker(
    data = df,
    aes(x = speed, y = dist, marker = label),
    size = 5, family = "FontAwesome"
  ) +
  scale_marker_discrete(glyphs = df$glyph,
                        colours = df$color,
                        limits = df$label)

enter image description here

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: rsh52