Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@
(@teunbrand, #3669).
* Added `scale_{x/y}_time(date_breaks, date_minor_breaks, date_labels)`
(@teunbrand, #4335).
* (internal) `legend.key.width` and `legend.key.height` calculations are no
longer precomputed before guides are drawn (@teunbrand, #6339)

# ggplot2 3.5.1

Expand Down
4 changes: 2 additions & 2 deletions R/guide-colorbar.R
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,10 @@ GuideColourbar <- ggproto(
# We set the defaults in `theme` so that the `params$theme` can still
# overrule defaults given here
if (params$direction == "horizontal") {
theme$legend.key.width <- theme$legend.key.width * 5
theme$legend.key.width <- rel(5)
valid_position <- c("bottom", "top")
} else {
theme$legend.key.height <- theme$legend.key.height * 5
theme$legend.key.height <- rel(5)
Comment on lines +296 to +299
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we haven't prepopulated these, we now just use a <rel> object to inherit a taller bar from legend.key.size.

valid_position <- c("right", "left")
}

Expand Down
4 changes: 0 additions & 4 deletions R/guides-.R
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,6 @@ Guides <- ggproto(
character(1), USE.NAMES = FALSE
)

# Populate key sizes
theme$legend.key.width <- calc_element("legend.key.width", theme)
theme$legend.key.height <- calc_element("legend.key.height", theme)

grobs <- self$draw(theme, positions, theme$legend.direction)
keep <- !vapply(grobs, is.zero, logical(1), USE.NAMES = FALSE)
grobs <- grobs[keep]
Expand Down
Loading