I have used the following ggplot
command:
ggplot(survey, aes(x = age)) + stat_bin(aes(n = nrow(h3), y = ..count.. / n), binwidth = 10)
+ scale
Here's how I did it with facet_grid(yfacet~xfacet)
using ggplot2, version 2.2.1:
facet_grid(
yfacet~xfacet,
labeller = labeller(
yfacet = c(`0` = "an y label", `1` = "another y label"),
xfacet = c(`10` = "an x label", `20` = "another x label")
)
)
Note that this does not contain a call to as_labeller()
-- something that I struggled with for a while.
This approach is inspired by the last example on the help page Coerce to labeller function.