CHOP-CGTInformatics / ggswim

Create swimmer plots with ggplot2
https://chop-cgtinformatics.github.io/ggswim/
Other
21 stars 3 forks source link

[FEATURE] Support FontAwesome Icons for Markers #60

Open rsh52 opened 1 day ago

rsh52 commented 1 day ago

Feature Request Description

It would be nice to also allow for fontawesome icons in addition to shapes/glyphs and emojis. the fontawesome package does not currently seem capable of doing this, but emojifont might.

Additional Context

Here is an example output using geom_text and the emojifont package:

library(ggplot2)
library(emojifont)
library(dplyr)

df <- cars |> 
  mutate(
    label = case_when(speed > 16 ~ emojifont::fontawesome("fa-car"),
                      .default = emojifont::fontawesome("fa-bicycle"))
  )

ggplot() +
  geom_text(data = df,
            aes(x = speed, y = dist, label = label, colour = label),
            family = 'fontawesome-webfont', show.legend = TRUE) +
  theme(legend.text=element_text(family='fontawesome-webfont'))

image

Checklist

skadauke commented 16 hours ago

A few comments here.