Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
legend glyphs (@teunbrand, #6594)
* Fixed regression where `NULL`-aesthetics contributed to plot labels too
insistently. Now they contribute only as fallback labels (@teunbrand, #6616)
* Fixed axis misplacement in `coor_radial()` when labels are blank (@teunbrand, #6574)

# ggplot2 4.0.0

Expand Down
5 changes: 2 additions & 3 deletions R/guide-axis.R
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ GuideAxis <- ggproto(
# Unlist the 'label' grobs
z <- if (params$position == "left") c(2, 1, 3) else 1:3
z <- rep(z, c(1, length(grobs$labels), 1))
has_labels <- !is_zero(grobs$labels[[1]])
grobs <- c(list(grobs$ticks), grobs$labels, list(grobs$title))

# Initialise empty gtable
Expand Down Expand Up @@ -452,13 +451,13 @@ GuideAxis <- ggproto(

# Add null-unit padding to justify based on eventual gtable cell shape
# rather than dimensions of this axis alone.
if (has_labels && params$position %in% c("left", "right")) {
if (params$position %in% c("left", "right")) {
where <- layout$l[-c(1, length(layout$l))]
just <- rotate_just(element = elements$text)$hjust %||% 0.5
gt <- gtable_add_cols(gt, unit(just, "null"), pos = min(where) - 1)
gt <- gtable_add_cols(gt, unit(1 - just, "null"), pos = max(where) + 1)
}
if (has_labels && params$position %in% c("top", "bottom")) {
if (params$position %in% c("top", "bottom")) {
where <- layout$t[-c(1, length(layout$t))]
just <- rotate_just(element = elements$text)$vjust %||% 0.5
gt <- gtable_add_rows(gt, unit(1 - just, "null"), pos = min(where) - 1)
Expand Down