Skip to content

geom_hexbin(): hexes appear stretched? #6461

Closed
@kevinushey

Description

@kevinushey

Using this code, from the examples:

d <- ggplot(diamonds, aes(carat, price))
d + geom_hex()

It seems like the plotted hexagons are now "squished" improperly, according to the aspect ratio of the current device. For example:

Image Image

Has it always been this way and I'm just misremembering? Or has something changed in how hexagonal bins are drawn?

Compare this with plots generated by e.g.

library(hexbin)
mixdata <-
  data.frame(x = c(rnorm(5000),rnorm(5000,4,1.5)),
             y = c(rnorm(5000),rnorm(5000,2,3)),
             a = gl(2, 5000))
hexbinplot(y ~ x, aspect = 2, data = mixdata)
Image Image

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