Skip to content

Commit 0e4394d

Browse files
authored
discard empty colourbar (#5681)
1 parent 7378156 commit 0e4394d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

R/guide-colorbar.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,11 @@ GuideColourbar <- ggproto(
223223
cli::cli_warn("{.fn guide_colourbar} needs continuous scales.")
224224
return(NULL)
225225
}
226-
Guide$extract_key(scale, aesthetic, ...)
226+
key <- Guide$extract_key(scale, aesthetic, ...)
227+
if (NROW(key) == 0) {
228+
return(NULL)
229+
}
230+
key
227231
},
228232

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

0 commit comments

Comments
 (0)