How can I use fontawesome icons in my plot axes in ggplot? I've tried pasting it together with text and then converting it to html using htmltools
, but it doesn't work.
Reproducible exmaple:
library(shiny)
library(tidyverse)
ui <- fluidPage(
plotOutput("example")
)
server <- function(input, output) {
output$example <- renderPlot({
mtcars %>%
ggplot(
aes(
x = wt,
y = mpg,
color = cyl
)
) +
geom_point() +
labs(
x = paste0("WT", icon("arrow-right")) %>% htmltools::HTML()
)
})
}
shinyApp(ui = ui, server = server)