legend.spacing.{x/y}
is not inherited in guide_legend()
.
#4977
Labels
legend.spacing.{x/y}
is not inherited in guide_legend()
.
#4977
I was working on some code related to legends, and found out that the legend guide doesn't do inheritance of the
legend.spacing.{x/y}
theme elements from the parentlegend.spacing
element.When I set a plot with
legend.spacing = *some largish number*
, I expect the spacing between the legend keys to increase relative to the default. Note that in the plot below, we can dispense with thetheme()
call and get exactly the same plot.Instead, I would have expected this:
Contrary to many issues posted about theme inheritance, the child element is truly empty in the default theme.
Created on 2022-09-03 by the reprex package (v2.0.1)
This is not a hard fix, and I'm happy to take it along in #4879, but it would be a visual change.* Would the maintainers agree to adjust this?
* It would be a visual change because currently,
legend.spacing.{x/y}
is typicallyNULL
in the default theme, which sets the spacing relative to the title text in the lines below (which would no longer occur if we adjust this):ggplot2/R/guide-legend.r
Lines 337 to 338 in a58b48c
The text was updated successfully, but these errors were encountered: