Skip to content

Better key_glyphs for geom_ribbon() and friends #6649

@teunbrand

Description

@teunbrand

The default key glyph for geom_area() is a polygon. My main gripe with this is that this doesn't reflect the outline.type = "upper" setting of the geom.

library(ggplot2)

ggplot(economics, aes(date, unemploy, fill = "Unemployment")) +
  geom_area(alpha = 0.5, colour = "black")

An alternative one might entertain is to allow a fill underneath the line in the timeseries key.

ggplot(economics, aes(date, unemploy, fill = "Unemployment")) +
  geom_area(alpha = 0.5, colour = "black", key_glyph = draw_key_timeseries)

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

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