Skip to content

Commit

Permalink
fix R CMD check error
Browse files Browse the repository at this point in the history
  • Loading branch information
Yunuuuu committed Nov 29, 2024
1 parent 04827f5 commit 92f57f8
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions R/guides-.R
Original file line number Diff line number Diff line change
Expand Up @@ -518,20 +518,26 @@ Guides <- ggproto(
for (i in seq_along(positions)) {
if (identical(positions[i], "inside")) {
# the actual inside position and justification can be set in each guide
# by `theme` argument
inside_justs[[i]] <- valid.just(calc_element(
"legend.justification.inside", params[[i]]$theme
)) %||% default_inside_just
inside_positions[[i]] <- calc_element(
"legend.position.inside", params[[i]]$theme
) %||% default_inside_position %||% inside_justs[[i]]
# by `theme` argument, here, we won't use `calc_element()` which will
# use inherits from `legend.justification` or `legend.position`, we only
# follow the inside elements from the guide theme
inside_just <- params[[i]]$theme[["legend.justification.inside"]]
if (is.null(inside_just)) {
inside_justs[[i]] <- default_inside_just
} else {
inside_justs[[i]] <- valid.just(inside_just)
}
inside_positions[[i]] <- params[[i]]$theme[[
"legend.position.inside"
]] %||% default_inside_position %||% inside_justs[[i]]
groups[i] <- paste("inside",
paste(inside_positions[[i]], collapse = "_"),
paste(inside_justs[[i]], collapse = "_"),
sep = "_"
)
}
}

positions <- positions[keep]
inside_positions <- inside_positions[keep]
inside_justs <- inside_justs[keep]
Expand Down Expand Up @@ -595,7 +601,7 @@ Guides <- ggproto(

# here, we put `inside_position` in the last, so that it won't break current
# implement of patchwork
package_box = function(grobs, position, theme,
package_box = function(grobs, position, theme,
inside_position = NULL, inside_just = NULL) {
if (is.zero(grobs) || length(grobs) == 0) {
return(zeroGrob())
Expand Down

0 comments on commit 92f57f8

Please sign in to comment.