We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 40e8b60 commit bad6f38Copy full SHA for bad6f38
R/guide-bins.R
@@ -320,10 +320,14 @@ guide_gengrob.bins <- function(guide, theme) {
320
321
key_size_mat <- do.call("cbind",
322
lapply(guide$geoms, function(g) g$data$size / 10)
323
- )[seq_len(n_keys), , drop = FALSE]
+ )
324
325
+ # key_size_mat can be an empty matrix (e.g. the data doesn't contain size
326
+ # column), so subset it only when it has any rows and columns.
327
if (nrow(key_size_mat) == 0 || ncol(key_size_mat) == 0) {
328
key_size_mat <- matrix(0, ncol = 1, nrow = n_keys)
329
+ } else {
330
+ key_size_mat <- key_size_mat[seq_len(n_keys), , drop = FALSE]
331
}
332
key_sizes <- apply(key_size_mat, 1, max)
333
0 commit comments