Open
Description
Hi!
Currently ggplot provides identity-detailed options for adjusting the properties of each element of the legend. The following options for legend.key.spacing{x/y}
, which adjusts the distance of each mini group, and legend.text
both work as expected.
ggplot2 3.5.0: Legends - Spacing and margins
(p <- ggplot(mpg, aes(displ, hwy, colour = class)) +
geom_point() +
guides(colour = guide_legend(ncol = 2))
)
p+
theme(
legend.key.spacing.x = unit(20, "pt"))

But I have a doubt about the legend.key.spacing
:
p+
theme(legend.key.spacing = unit(20, "pt"))

From the result, it looks like the key
and label
spacing has changed. As legend.text = element_text (margin = margin (l = ...))
has been changed.
Should the distance between key
and label
change when using legend.key.spacing
? I'm not quite sure if this is an intentional feature or a bug.
Best wishes,
Hu