Skip to content

Commit

Permalink
Avoid split data frame if there's only one panel
Browse files Browse the repository at this point in the history
  • Loading branch information
zeehio committed Nov 6, 2022
1 parent 63125db commit 6e4077e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion R/geom-.r
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@ Geom <- ggproto("Geom",
# Trim off extra parameters
params <- params[intersect(names(params), self$parameters())]

lapply(split(data, data$PANEL), function(data) {
if (length(levels(data$PANEL)) > 1L) {
data_panels <- split(data, data$PANEL)
} else {
data_panels <- list(data)
}
lapply(data_panels, function(data) {
if (empty(data)) return(zeroGrob())

panel_params <- layout$panel_params[[data$PANEL[1]]]
Expand Down

0 comments on commit 6e4077e

Please sign in to comment.