Skip to content

Feature request: geom_hex() should support variable hex sizes #6727

@teunbrand

Description

@teunbrand

The idea is to allow the size of the hex to vary along with data. In the plot below, it'd mean that the dark blue hexes would become very small and light blue hexes to remain the full size.

library(ggplot2)

ggplot(faithful, aes(waiting, eruptions)) +
  geom_hex(aes(scale = after_stat(ncount)))
#> Warning in geom_hex(aes(scale = after_stat(ncount))): Ignoring unknown
#> aesthetics: scale

Created on 2025-11-04 with reprex v2.1.1

The main trouble I imagine is having this encoded in a legend key. The size of hexes are dependent on the position data (width/height in data units), whereas the legend keys cannot correctly scale along with this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions