0

I want to have an expression partly italicised in a facet label in ggplot2, but I don't seem to be able to do it the way I have seen it here around.

I tried using element_markdown() as I have seen here around like this:

levels(iris$Species) <- c("look at *I. setosa*",
                          "and also at *I. versicolor*",
                          "finally, at *I. virginica*")

ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width)) +
  geom_point() +
  facet_wrap(~Species) +
  theme(strip.text = ggtext::element_markdown())

Am I missing something?! The "*" are gone but the species are not italicised! Thank You all!

stefan
  • 90,330
  • 6
  • 25
  • 51

1 Answers1

1

I had to update all packages related to ggplot (I updated tidyverse ), as well as ggtext (to 0.1.2), gridtext (to 0.1.5) and R itself (to 4.2.2) . Now it works :-)

Thanks to @stefan and @MrFlick