Skip to content

Commit 7582d60

Browse files
authored
fix bad default for legend spacing variables. closes #2943. (#3276)
1 parent 837e601 commit 7582d60

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ core developer team.
112112
* `geom_violin()` no longer throws an error when quantile lines fall outside
113113
the violin polygon (@thomasp85, #3254).
114114

115+
* `guide_legend()` and `guide_colorbar()` now use appropriate spacing between legend
116+
key glyphs and legend text even if the legend title is missing (@clauswilke, #2943).
117+
115118
* Default labels are now generated more consistently; e.g., symbols no longer
116119
get backticks, and long expressions are abbreviated with `...`
117120
(@yutannihilation, #2981).

R/guide-colorbar.r

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,8 @@ guide_gengrob.colorbar <- function(guide, theme) {
342342

343343
title_width <- width_cm(grob.title)
344344
title_height <- height_cm(grob.title)
345-
title_fontsize <- title.theme$size %||% calc_element("legend.title", theme)$size %||% 0
345+
title_fontsize <- title.theme$size %||% calc_element("legend.title", theme)$size %||%
346+
calc_element("text", theme)$size %||% 11
346347

347348
# gap between keys etc
348349
# the default horizontal and vertical gap need to be the same to avoid strange

R/guide-legend.r

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,8 @@ guide_gengrob.legend <- function(guide, theme) {
327327

328328
title_width <- width_cm(grob.title)
329329
title_height <- height_cm(grob.title)
330-
title_fontsize <- title.theme$size %||% calc_element("legend.title", theme)$size %||% 0
330+
title_fontsize <- title.theme$size %||% calc_element("legend.title", theme)$size %||%
331+
calc_element("text", theme)$size %||% 11
331332

332333
# gap between keys etc
333334
# the default horizontal and vertical gap need to be the same to avoid strange

0 commit comments

Comments
 (0)