Skip to content

vjust is ignored in position_stack() in 4.0.0 #6692

@SCasanova

Description

@SCasanova

I found a problem when updating the package to 4.0.0 in one of my visualizations. In a column chart, the labels produced by geom_text() used position = position_stack(vjust = 0.5) to center in the middle of the bars. The argument is now getting ignored.

Here is the code to reproduce the bug:

``` r
library(ggplot2)


test <- tibble::tibble(bin = seq(3), count = c(23,22,10))

ggplot(test, aes(x = bin, y = count))+
  geom_col(position = 'dodge',
           width=0.99,
           fill = '#DC9542',
           alpha = 0.85)+
  theme_minimal()+
  geom_text(
    aes(label = round(count, 2), y = count + 1),
    position = position_stack(vjust = 0)
  )

ggplot(test, aes(x = bin, y = count))+
  geom_col(position = 'dodge',
           width=0.99,
           fill = '#DC9542',
           alpha = 0.85)+
  theme_minimal()+
  geom_text(
    aes(label = round(count, 2), y = count + 1),
    position = position_stack(vjust = 1)
  )

ggplot(test, aes(x = bin, y = count))+
  geom_col(position = 'dodge',
           width=0.99,
           fill = '#DC9542',
           alpha = 0.85)+
  theme_minimal()+
  geom_text(
    aes(label = round(count, 2), y = count + 1),
    position = position_stack(vjust = 0.5)
  )

Created on 2025-10-09 with reprex v2.1.1

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions