tidyverse / ggplot2

An implementation of the Grammar of Graphics in R
https://ggplot2.tidyverse.org
Other
6.5k stars 2.03k forks source link

stat_binhex() fails to notify users that they need to install hexbin package #4736

Closed yutannihilation closed 2 years ago

yutannihilation commented 2 years ago

https://github.com/tidyverse/ggplot2/pull/4671#issuecomment-1046090308

I can reproduce this on my local without hexbin installed.

> library(ggplot2)
> d <- ggplot(diamonds, aes(carat, price))
> d + geom_hex()
Warning message:
Computation failed in `stat_binhex()`:

I think this is because check_installed is inside compute_group, where the error is ignored.

https://github.com/tidyverse/ggplot2/blob/c89c265a57fd71f8a0288ce81037296aadc0a012/R/stat-binhex.r#L52

yutannihilation commented 2 years ago

Related: https://github.com/tidyverse/ggplot2/issues/4843

yutannihilation commented 2 years ago

Resolved by #4856