Skip to content

Fill and color guides for factor with drop=FALSE don't show color. #5869

Closed
@ltierney

Description

@ltierney

In ggplot2 3.5.1 the fill guide for a factor where not all level sare present but drop=FALSE is used shows the label for the missing level but not the color. A simple example:

library(ggplot2)
d <-data.frame(x = factor(1:3, levels = 1:4), y = 1:3)
ggplot(d, aes(x, y, fill = x)) + 
    geom_col() +
    scale_fill_discrete(drop = FALSE)

This was different in the version available a year ago. Compare
this from 2024 to this from 2023.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions