I need to fill $\lambda$ = x
(6 values of x) on each of the 6 facet_grid panels
ggplot(mtcars, aes(mpg, wt))
geom_point()
facet_grid(am ~ cyl)
theme(panel.spacing = unit(1, "lines"))
annotate("text", label = c("\u03BB = 1", "\u03BB = 2", "\u03BB = 0.1", "\u03BB = 2.2", "\u03BB = 1.5", "\u03BB = 5") , size = 4, x = 30, y = 5)
I've modified the solutions here
CodePudding user response:
One option to achieve your desired result would be to add the labels via a geom_text
and a data.frame of labels like so:
library(ggplot2)
df_label <- data.frame(
label = c("\u03BB = 1", "\u03BB = 2", "\u03BB = 0.1", "\u03BB = 2.2", "\u03BB = 1.5", "\u03BB = 5"),
am = rep(0:1, each = 3),
cyl = rep(c(4, 6, 8), 2)
)
ggplot(mtcars, aes(mpg, wt))
geom_point()
geom_text(data = df_label, aes(label = label), size = 4, x = 30, y = 5)
facet_grid(am ~ cyl)
theme(panel.spacing = unit(1, "lines"))