When a label exceeds the maximum length as defined by the user, the function splits the text/label on the first space after the centre of the string. This is very useful for long labels in a plot
plot_label_splitter(label, maxlength)
A character array (the label)
When the label exceeds this length, it will be split into a two-line label
The function can be easily applied to a data.frame
by using e.g. sapply
plot_label_splitter("Exotic long label", 10)
#> [1] "Exotic long\nlabel"