Given the example code below, how do I control alignment of legend when bottom-placed? E.g. left-aligned?
# Load libraries ----------------------------------------------------------
library("tidyverse")
# Define data -------------------------------------------------------------
d = tribble(
~x, ~lbl, ~cat,
1, "This is one value in the dataset we are working with", "This is one category",
2, "This is another", "This is another",
3, "This is yet another", "This is yet another",
4, "And just one more", "And just one more",
5, "Then the last one right here", "Then the last one right here, concluding all the categories"
)
# Do visualisation --------------------------------------------------------
d %>%
ggplot(aes(x = x, y = lbl, colour = cat)) +
geom_point() +
theme(legend.position = "bottom") +
labs(y = "") +
guides(colour = guide_legend(nrow = 2, byrow = TRUE))