How to add custom label in facet_grid ()

I am trying to add an arbitrary facet label to a graph that has been faceted with the facet_grid()following:

p <- qplot(wt, mpg, data = mtcars)
p <- p + facet_grid(. ~ vs, labeller = label_bquote(alpha^a==alpha^b))

This is still great. However, when I add a variable on which I split into an equation on a face label, for example:

p <- qplot(wt, mpg, data = mtcars)
p <- p + facet_grid(. ~ vs, labeller = label_bquote(alpha^a==alpha^b==.(x)))

I get the following error:

Error: unexpected '==' in "p <- p + facet_grid (. ~ Vs, labeller = label_bquote (alpha ^ a == alpha ^ b =="

Can someone help me in this seemingly trivial problem?

+4
source share
2 answers

, , ==, . , R . , R {}:

p <- p + facet_grid(. ~ vs, labeller = label_bquote({alpha^a==alpha^b}==.(x)))

enter image description here

+5

, .

p <- p + facet_grid(. ~ vs, labeller = label_bquote({alpha^a==alpha^b}==.(x)))
+2

All Articles