You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The old guide system used lists. This trips up a check in guides(), which throws this spurious warning:
library(ggplot2)
old_guide<-metR:::guide_colourstrip()
is.list(old_guide)
#> [1] TRUEnew_guide<- guide_colorbar()
is.list(new_guide)
#> [1] FALSEmtcars|>
ggplot(aes(gear, carb)) +
geom_point() +
guides(fill=old_guide)
#> Warning: The `<scale>` argument of `guides()` cannot be `FALSE`. Use "none" instead as#> of ggplot2 3.3.4.#> This warning is displayed once every 8 hours.#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was#> generated.
deprecate_warn0("3.3.4", "guides(`<scale>` = 'cannot be `FALSE`. Use \"none\" instead')")
args[idx_false] <-"none"
}
Line 76 seems to be there to support a guides(list(fill = ..., colour = ...)) syntax. But when using the old guide system, the logic makes args point to the first guide. Then line 79 iterates over the elements of the guide and if one of them is FALSE then it converts it to "none" and throws the warning.
The text was updated successfully, but these errors were encountered:
eliocamp
changed the title
guides() throw espurious warning when using old guides.guides() breaks breaks old guides.
Jan 24, 2025
eliocamp
changed the title
guides() breaks breaks old guides.guides() breaks breaks old guides if the first argument is an old guide
Jan 24, 2025
eliocamp
changed the title
guides() breaks breaks old guides if the first argument is an old guideguides() breaks old guides if the first argument is an old guide
Jan 24, 2025
Thanks for the report Elio! I think this might be a duplicate of #6165, for which we merged a fix 3 days ago. Does updating the development version of ggplot2 help at all?
The old guide system used lists. This trips up a check in
guides()
, which throws this spurious warning:The problem is here:
ggplot2/R/guides-.R
Lines 76 to 83 in 97edd62
Line 76 seems to be there to support a
guides(list(fill = ..., colour = ...))
syntax. But when using the old guide system, the logic makesargs
point to the first guide. Then line 79 iterates over the elements of the guide and if one of them isFALSE
then it converts it to "none" and throws the warning.The text was updated successfully, but these errors were encountered: