Skip to content

Commit 6e4077e

Browse files
committed
Avoid split data frame if there's only one panel
1 parent 63125db commit 6e4077e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

R/geom-.r

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@ Geom <- ggproto("Geom",
7878
# Trim off extra parameters
7979
params <- params[intersect(names(params), self$parameters())]
8080

81-
lapply(split(data, data$PANEL), function(data) {
81+
if (length(levels(data$PANEL)) > 1L) {
82+
data_panels <- split(data, data$PANEL)
83+
} else {
84+
data_panels <- list(data)
85+
}
86+
lapply(data_panels, function(data) {
8287
if (empty(data)) return(zeroGrob())
8388

8489
panel_params <- layout$panel_params[[data$PANEL[1]]]

0 commit comments

Comments
 (0)