I am interested in building a custom expression containing a comma on one face of the graph in ggplot2. I know how to build expressions on one face using a new data frame as follows:
fakedata <- data.frame(x = 1:10, y=runif(10), grp=gl(2,5))
ggplot(fakedata, aes(x=x,y,y)) + geom_point() + facet_grid(. ~ grp) +
geom_text(data=data.frame(x=5,y=0.5,grp=1,lab='a == 5'), aes(label=lab), parse=TRUE)

I also know how to build expressions on multiple faces using annotation_custom, which can hold a semicolon expression. But this cannot be done on one side only.
ggplot(fakedata, aes(x=x,y,y)) + geom_point() + facet_grid(. ~ grp) +
annotation_custom(grobTree(textGrob(expression(paste(a == 5, ', ', b == 6)), x=.5, y=.5)))

But I can’t understand what to do for a semicolon expression on the same face, since you cannot store previously defined expressions in a data frame. How can I build a semicolon expression on the same face?
source
share