Truncate the labels of a plot's discrete x-axis labels so that the text does not overflow and collide with other bars.

scale_x_truncate(n = 15, ...)

scale_x_wrap(width = 15, ...)

Arguments

n

The maximum width of string. Passed to stringr::str_trunc().

...

Additional arguments passed to ggplot2::scale_x_discrete().

width

Positive integer giving target line width in characters. A width less than or equal to 1 will put each word on its own line. Passed to stringr::str_wrap().