Skip to content

Commit 5023b79

Browse files
committed
Generate one zeroGrob for each panel.
Fixes #1445
1 parent 1875bb8 commit 5023b79

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# ggplot2 2.0.0.9000
22

3+
* Multipanel empty data is correctly plotted, rather than throwing an unhelpful
4+
error (#1445).
5+
36
* Eliminate spurious warning if you have a layer with no data and no aesthetics
47
(#1451).
58

R/geom-.r

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ Geom <- ggproto("Geom",
6767
},
6868

6969
draw_layer = function(self, data, params, panel, coord) {
70-
if (empty(data)) return(list(zeroGrob()))
70+
if (empty(data)) {
71+
n <- nlevels(data$PANEL)
72+
return(rep(list(zeroGrob()), n))
73+
}
7174

7275
# Trim off extra parameters
7376
params <- params[intersect(names(params), self$parameters())]

0 commit comments

Comments
 (0)