Skip to content

Commit

Permalink
discard empty colourbar (#5681)
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand authored and thomasp85 committed Feb 23, 2024
1 parent 465ef21 commit 9fa2b09
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion R/guide-colorbar.R
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,11 @@ GuideColourbar <- ggproto(
cli::cli_warn("{.fn guide_colourbar} needs continuous scales.")
return(NULL)
}
Guide$extract_key(scale, aesthetic, ...)
key <- Guide$extract_key(scale, aesthetic, ...)
if (NROW(key) == 0) {
return(NULL)
}
key
},

extract_decor = function(scale, aesthetic, nbin = 300, reverse = FALSE, alpha = NA, ...) {
Expand Down

0 comments on commit 9fa2b09

Please sign in to comment.