Reputation: 5841
I'm plotting variables with double subscripts, and I would like to be able to keep the subscripts from getting mashed together in the facet strip text. Each label should display something like $\beta_{1, 12}$ instead of $\beta_112$. It should be enough to fix the following MWE.
d = data.frame(
x = rnorm(6),
y = rnorm(6),
z = rep(paste0("beta[", 1:3, "][", 12, "]"), each = 2))
library(ggplot2)
pl = ggplot(d) +
geom_point(aes(x, y)) +
facet_wrap(~z, labeller = label_parsed)
Upvotes: 2
Views: 1310
Reputation: 22827
How about this?
library(ggplot2)
d = data.frame(
x = rnorm(6),
y = rnorm(6),
z = rep(paste0("beta[", 1:3, "~~", 12, "]"), each = 2))
pl = ggplot(d) +
geom_point(aes(x, y)) +
facet_wrap(~z, labeller = label_parsed)
pl
Upvotes: 1