Skip to content

geom_hex ignores size aesthetic/parameter #2488

Closed
@econandrew

Description

@econandrew

geom_hex defines a size default of 0.5, which by analogy with other filled geoms I would expect to control line weight (e.g. geom_bin2d, see bottom).

But it never gets passed to hexGrob so there is no change in the output size.

There's also an interesting inconsistency which may or may not be issue-worthy: geom_hex claims size as an aesthetic (in docs), whereas geom_bin2d does not, and for geom_bin2d size does indeed not work as an a aesthetic, only as a parameter, it seems.

library(ggplot2)
p <- ggplot(diamonds, aes(carat, price))

# This doesn't work as expected
p + geom_hex(size = 0.1, color = "red")

p + geom_hex(size = 2, color = "red")

p + geom_hex(aes(size = cut), color = "red")
#> Warning: Using size for a discrete variable is not advised.

# This does work as expected
p + geom_bin2d(size = 0.1, color = "red")

p + geom_bin2d(size = 2, color = "red")

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