'ggplot2, getting a % symbol in subscript within axis labels
I'm trying to get a % symbol in the axis as subscript. Typically, using expression and square brakets [] you can get subscripts. But symbols don't seem to be parsing correctly as I get an error. Does anyone know how to fix or a work around? For instance, what would I do if I want % in subscript below:
library(tidyverse)
iris %>% ggplot(aes(x = Sepal.Length, y = Sepal.Width)) +
geom_point(aes(colour = Species)) +
geom_smooth(method = loess) +
labs(y = expression(Blah[1*d]*"%"))
When the % sign is moved in the brackets
iris %>% ggplot(aes(x = Sepal.Length, y = Sepal.Width)) +
geom_point(aes(colour = Species)) +
geom_smooth(method = loess) +
labs(y = expression(Blah[1d%]))
the following error message appears:
Error: unexpected symbol in: " geom_smooth(method = loess) +
labs(y = expression(Blah[1d"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
