Skip to content

Commit 1de623f

Browse files
committed
no need to prepare inside legends when empty
1 parent 9854c58 commit 1de623f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

R/plot-build.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,8 @@ table_add_tag <- function(table, label, theme) {
448448
table_add_legends <- function(table, legends, theme) {
449449

450450
if (is.zero(legends)) {
451-
legends <- rep(list(zeroGrob()), 5)
452-
names(legends) <- c(.trbl, "inside")
451+
legends <- rep(list(zeroGrob()), 4)
452+
names(legends) <- .trbl
453453
}
454454

455455
# Extract sizes
@@ -515,7 +515,7 @@ table_add_legends <- function(table, legends, theme) {
515515

516516
# Add manual legend
517517
place <- find_panel(table)
518-
inside_legends <- .subset(legends, startsWith(names(legends), "inside"))
518+
inside_legends <- legends[startsWith(names(legends), "inside")]
519519
if (length(inside_legends)) {
520520
for (i in seq_along(inside_legends)) {
521521
table <- gtable_add_grob(

0 commit comments

Comments
 (0)