teunbrand/ggh4x

check.overlap = TRUE throws error

Closed this issue · 1 comments

Dear Teun van den Brand,

Thank you for this very nice package! However, I discovered that the function guide_axis_color throws an error, when check.overlap = TRUE is specified. I provide a minimal example (for which check.overlap = TRUE is not really necessary) to illustrate the error:

p <- ggplot(mtcars, aes(wt, mpg)) +
  geom_point() +
  theme(axis.line = element_line(colour = "black"))

p + guides(x = guide_axis_colour(colour = "red", check.overlap = TRUE),
           y = guide_axis_colour(colour = "blue"))

This code yields to the error message Error in FUN(X[[i]], ...) : object 'n' not found. Do you maybe know how to fix it?
Thank you very much in advance!

Best,
David

Hi there, thanks for the report! This appears to be a bug. I don't know of a workaround at the moment, other than not using the check.overlap option or replacing the colours in the theme yourself.