I would like to check if someone knows how to format legend so that text values in legend are not presented in two lines bur rather on one single line and attachment.
I couldn't get the legend to wrap automatically for some reason but there is an nrow argument available for legends.
library(ggplot2)
DF <- data.frame(Name = rep(LETTERS[1:4], 4),
Sub = rep(c("Long Name and Even More More 1",
"Long Name and Even More More 2",
"Long Name and Even More 3",
"Long Nmae and Even More 4"), each = 4),
Value = runif(16, 1, 20))
Plt <- ggplot(DF, aes(Name, Value, fill = Sub)) + geom_col() +
theme(legend.title = element_blank(),
legend.position = "top",
legend.box = "horizontal",
legend.box.just = "left")
Plt