'Greek letters in facet_wrap labels for Plotly
I have been trying to transfer a ggplot using facet_wrap, for which I have labels and their greek letters to a Plotly plot using ggplotly. This, however, leads to the facet labels only displaying their unparsed expression.
library(ggplot2)
library(plotly)
# Get exemplary expression.
mpg$class[mpg$class == 'compact'] <- 'beta[0]'
mpg$class[mpg$class == '2seater'] <- 'alpha[0]'
p <- ggplot(mpg[mpg$class %in% c('beta[0]', 'alpha[0]'),], aes(displ, hwy)) + geom_point()
p <- p + facet_wrap(vars(class), labeller = label_parsed)
p # These facet labels work as intended.
ggplotly(p) # This will produce facet labels with the unparsed expression.
How would I go about adding the desired format (greek letters and subscript) in the Plotly output?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
