Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

geom_hex fails when filled with a continuous variable #967

Closed
richierocks opened this issue May 22, 2014 · 3 comments
Closed

geom_hex fails when filled with a continuous variable #967

richierocks opened this issue May 22, 2014 · 3 comments

Comments

@richierocks
Copy link
Contributor

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")
@hadley hadley closed this as completed in a6e045e Jun 15, 2015
@hadley
Copy link
Member

hadley commented Jun 15, 2015

This no longer fails - it probably doesn't do what you want, but makes sense as a consequence of the default grouping rules, and the inability to stack/dodge hexagons.

ggplot(mpg, aes(class, fill = hwy)) + 
  geom_bar()
ggplot(mpg, aes(class, fill = hwy, group = hwy)) + 
  geom_bar()

@mplourde
Copy link

richierocks example still fails, but an alternative method is presented here

@hadley
Copy link
Member

hadley commented Aug 19, 2015

@mplourde example works for me. You probably need the dev version.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants