Skip to content

Fill colours are ignored in draw_key_rect #6608

@mitchelloharawild

Description

@mitchelloharawild

A regression introduced in ggplot2 v4.0.0 resulting from #6327 results in grey20 fills when a valid fill is mapped.

ggplot2 v.3.5.2

library(ggplot2)

# Column chart
mtcars |> 
  ggplot(aes(x = factor(cyl), fill = factor(cyl))) +
  geom_col(aes(y = mpg), key_glyph = draw_key_rect)

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

ggplot2 v4.0.0

library(ggplot2)

# Column chart
mtcars |> 
  ggplot(aes(x = factor(cyl), fill = factor(cyl))) +
  geom_col(aes(y = mpg), key_glyph = draw_key_rect)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions