30 May 2020
The labels parameter of scale_x_discrete() (and similar functions) can directly take a function:
[...] + scale_x_discrete(labels=function(x){sub("\\s", "\n", x)})
R
ggplot2
package
plot
visualization
function