yutannihilation / gghighlight

Highlight points and lines in ggplot2

Home Page:https://yutannihilation.github.io/gghighlight/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Weird failure with dev purrr

hadley opened this issue · comments

library(ggplot2)
library(gghighlight)

ggplot(mtcars, aes(wt, mpg, colour = factor(cyl))) +
  geom_point() +
  gghighlight(100 < disp, disp <= 300, use_group_by = FALSE)
#> label_key: NULL
#> Error in `ggrepel::geom_label_repel()`:
#> ! Problem while setting up geom.
#> ℹ Error occurred in the 3rd layer.
#> Caused by error in `compute_geom_1()`:
#> ! `geom_label_repel()` requires the following missing aesthetics: label

Created on 2022-09-28 with reprex v2.0.2

Any ideas what might going wrong here? I'm happy to help if you can point me to where the problem might be coming from

Thanks for the report, I'll investigate.

Here's the subtle difference that matters. My code assumed it's NULL when the subsetted uneval object is empty. Using is_empty() should fix the issue (59c77dc).

w/ the CRAN version of purrr

x <- list(
  list(key = ggplot2::aes()),       # different result
  list(key = ggplot2::aes(x = foo)) # same result
)

purrr::map(x, "key")
#> [[1]]
#> NULL
#> 
#> [[2]]
#> Aesthetic mapping: 
#> * `x` -> `foo`

packageVersion("purrr")
#> [1] '0.3.4'

Created on 2022-10-05 with reprex v2.0.2

w/ the dev version of purrr

x <- list(
  list(key = ggplot2::aes()),       # different result
  list(key = ggplot2::aes(x = foo)) # same result
)

purrr::map(x, "key")
#> [[1]]
#> Aesthetic mapping: 
#> <empty>
#> 
#> [[2]]
#> Aesthetic mapping: 
#> * `x` -> `foo`

packageVersion("purrr")
#> [1] '0.9000.0.9000'

Created on 2022-10-05 with reprex v2.0.2

Thanks for looking into this! This was a deliberate change to pluck(): tidyverse/purrr#893

I see, thanks for the detail. The new behavior looks good!

I'll let you know when I actually start the purrr release process and we have a target CRAN submission date. It's likely to be at least a few weeks away.