The answer from this post addresses a spacing issue for ggplots with multi lines and exponents in the second line. Specifically something like this:
<code>library(ggplot2)
library(magrittr)
iris %>%
ggplot(aes(x = Sepal.Length, y = Sepal.Length)) +
geom_point() +
labs(x = expression(paste('This is the first line of the x labeln', x^-1, ')')))
</code>
<code>library(ggplot2)
library(magrittr)
iris %>%
ggplot(aes(x = Sepal.Length, y = Sepal.Length)) +
geom_point() +
labs(x = expression(paste('This is the first line of the x labeln', x^-1, ')')))
</code>
library(ggplot2)
library(magrittr)
iris %>%
ggplot(aes(x = Sepal.Length, y = Sepal.Length)) +
geom_point() +
labs(x = expression(paste('This is the first line of the x labeln', x^-1, ')')))
However, I can’t seem to figure out how to get the superscript minus from unicode working. I tried all of these options. Here is an example that gets a minus sign but not a superscript minus sign:
<code>iris %>%
ggplot(aes(x = Sepal.Length, y = Sepal.Length)) +
geom_point() +
labs(x = 'This is the first line of the x labeln(xU2212u00b9)')
</code>
<code>iris %>%
ggplot(aes(x = Sepal.Length, y = Sepal.Length)) +
geom_point() +
labs(x = 'This is the first line of the x labeln(xU2212u00b9)')
</code>
iris %>%
ggplot(aes(x = Sepal.Length, y = Sepal.Length)) +
geom_point() +
labs(x = 'This is the first line of the x labeln(xU2212u00b9)')
Any help is appreciated!