Skip to content

geom_hex fails when filled with a continuous variable #967

@richierocks

Description

@richierocks

To reproduce, try:

d <- ggplot(diamonds, aes(carat, price))
d + geom_hex(aes(fill = depth))
## Error in unit(tic_pos.c, "mm") : 'x' and 'units' must have length > 0

Here's the stack trace using options(error = recover):

1: print(list(data = list(carat = c(0.23, 0.21, 0.23, 0.29, 0.31, 0.24, 0.24, 
2: print.ggplot(list(data = list(carat = c(0.23, 0.21, 0.23, 0.29, 0.31, 0.24,
3: plot-render.r#185: ggplot_gtable(data)
4: plot-render.r#82: build_guides(plot$scales, plot$layers, plot$mapping, posi
5: guides-.r#129: guides_gengrob(gdefs, theme)
6: guides-.r#220: lapply(gdefs, guide_gengrob, theme)
7: FUN(X[[1]], ...)
8: guides-.r#291: guide_gengrob.colorbar(X[[1]], ...)
9: guide-colorbar.r#265: unit(tic_pos.c, "mm")

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