plotmath
Displaying a greater than or equal sign
An alternative to using expressions is Unicode characters, in this case Unicode Character ‘GREATER-THAN OR EQUAL TO’ (U+2265). Copying @mnel’s example .d <- data.frame(a = letters[1:6], y = 1:6) ggplot(.d, aes(x=a,y=y)) + geom_point() + scale_x_discrete(labels = c(letters[1:5], “\u2265 80”)) Unicode is a good alternative if you have trouble remembering the complicated expression syntax or if … Read more
Line break in expression()?
You can easily use line breaks in regular paste, but this is plotmath paste (actually a different function also with no ‘sep’ argument) and the (long) ?plotmath page specifically tells you it cannot be done. So what’s the work-around? Using the plotmath function atop is one simple option: expression(atop(“Histogram of “*hat(mu), Bootstrap~samples*’,’~Allianz)) This will break … Read more
How to change facet labels?
Here is a solution that avoids editing your data: Say your plot is facetted by the group part of your dataframe, which has levels control, test1, test2, then create a list named by those values: hospital_names <- list( ‘Hospital#1’=”Some Hospital”, ‘Hospital#2’=”Another Hospital”, ‘Hospital#3’=”Hospital Number 3″, ‘Hospital#4’=”The Other Hospital” ) Then create a ‘labeller’ function, and … Read more