Skip to content

Commit 7f12f21

Browse files
committed
Rename nullGrob to zeroGrob
1 parent c6918fe commit 7f12f21

15 files changed

+34
-33
lines changed

NEWS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ ggplot2 0.8.4 (2008-XX-XX)
1515
* stat_qq: now correctly groups results
1616
* facet_wrap: can now specify both ncol and nrow without getting an error
1717
* facet_wrap: now works with statistics that produce both x and y values (e.g. stat_qq)
18-
* geom_boxplot: alpha now affects fill colour of boxes only
18+
* geom_boxplot: alpha now affects fill colour of boxes only
19+
* nullGrob renamed to zeroGrob to avoid name conflict with grid

R/facet-grid-.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ FacetGrid <- proto(Facet, {
180180
col.labels <- add.names(rcolnames(gm))
181181

182182
strip_h <- apply(col.labels, c(2,1), ggstrip, theme = theme)
183-
if (nrow(strip_h) == 1 && ncol(strip_h) == 1) strip_h <- matrix(list(nullGrob()))
183+
if (nrow(strip_h) == 1 && ncol(strip_h) == 1) strip_h <- matrix(list(zeroGrob()))
184184
strip_v <- apply(row.labels, c(1,2), ggstrip, horizontal=FALSE, theme=theme)
185-
if (nrow(strip_v) == 1 && ncol(strip_v) == 1) strip_v <- matrix(list(nullGrob()))
185+
if (nrow(strip_v) == 1 && ncol(strip_v) == 1) strip_v <- matrix(list(zeroGrob()))
186186

187187
list(
188188
h = strip_h,

R/geom-.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Geom <- proto(TopLevel, expr={
2020

2121
draw <- function(...) {}
2222
draw_groups <- function(., data, scales, coordinates, ...) {
23-
if (empty(data)) return(nullGrob())
23+
if (empty(data)) return(zeroGrob())
2424

2525
groups <- split(data, factor(data$group))
2626
grobs <- lapply(groups, function(group) .$draw(group, scales, coordinates, ...))

R/geom-blank.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ GeomBlank <- proto(Geom, {
1414
}
1515

1616
draw_legend <- function(., data, ...) {
17-
nullGrob()
17+
zeroGrob()
1818
}
1919

2020

R/geom-path-.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ GeomPath <- proto(Geom, {
77
# Silently drop lines with less than two points, preserving order
88
rows <- ave(seq_len(nrow(munched)), munched$group, FUN = length)
99
munched <- munched[rows >= 2, ]
10-
if (nrow(munched) < 2) return(nullGrob())
10+
if (nrow(munched) < 2) return(zeroGrob())
1111

1212
# Work out whether we should use lines or segments
1313
attr <- ddply(munched, .(group), function(df) {

R/geom-point-.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ GeomPoint <- proto(Geom, {
33
draw <- function(., data, scales, coordinates, na.rm = FALSE, ...) {
44
data <- remove_missing(data, na.rm,
55
c("x", "y", "size", "shape"), name = "geom_point")
6-
if (empty(data)) return(nullGrob())
6+
if (empty(data)) return(zeroGrob())
77

88
with(coordinates$transform(data, scales),
99
ggname(.$my_name(), pointsGrob(x, y, size=unit(size, "mm"), pch=shape,

R/grob-grid.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ grobGrid <- function(name, nrow, ncol, grobs = NULL, widths = 1, heights = 1, cl
4444

4545
# stopifnot(is.list(grobs))
4646
if (is.null(grobs)) {
47-
grobs <- matrix(list(nullGrob()), nrow = nrow, ncol = ncol)
47+
grobs <- matrix(list(zeroGrob()), nrow = nrow, ncol = ncol)
4848
} else {
49-
mat <- c(grobs, rep(list(nullGrob()), nrow * ncol - length(grobs)))
49+
mat <- c(grobs, rep(list(zeroGrob()), nrow * ncol - length(grobs)))
5050
dim(mat) <- c(ncol, nrow)
5151
grobs <- t(mat)
5252
}

R/grob-null.r

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
# Null grob
2-
# The null grob does nothing and has zero size.
1+
# Zero grob
2+
# The zero grob draws nothing and has zero size.
33
#
4-
# @alias widthDetails.nullGrob
5-
# @alias heightDetails.nullGrob
6-
# @alias grobWidth.nullGrob
7-
# @alias grobHeight.nullGrob
8-
# @alias drawDetails.nullGrob
4+
# @alias widthDetails.zeroGrob
5+
# @alias heightDetails.zeroGrob
6+
# @alias grobWidth.zeroGrob
7+
# @alias grobHeight.zeroGrob
8+
# @alias drawDetails.zeroGrob
99
# @keyword internal
10-
nullGrob <- function() .nullGrob
10+
zeroGrob <- function() .zeroGrob
1111

12-
.nullGrob <- grob(cl = "nullGrob", name = "NULL")
13-
widthDetails.nullGrob <-
14-
heightDetails.nullGrob <-
15-
grobWidth.nullGrob <-
16-
grobHeight.nullGrob <- function(x) unit(0, "cm")
12+
.zeroGrob <- grob(cl = "zeroGrob", name = "NULL")
13+
widthDetails.zeroGrob <-
14+
heightDetails.zeroGrob <-
15+
grobWidth.zeroGrob <-
16+
grobHeight.zeroGrob <- function(x) unit(0, "cm")
1717

18-
drawDetails.nullGrob <- function(x, recording) {}
18+
drawDetails.zeroGrob <- function(x, recording) {}
1919

R/guides-legend.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ guide_legends_box <- function(scales, layers, default_mapping, horizontal = FALS
1616
legs <- guide_legends(scales, layers, default_mapping, theme=theme)
1717

1818
n <- length(legs)
19-
if (n == 0) return(nullGrob())
19+
if (n == 0) return(zeroGrob())
2020

2121
if (!horizontal) {
2222
width <- do.call("max", lapply(legs, widthDetails))
@@ -71,7 +71,7 @@ guide_legends <- function(scales, layers, default_mapping, theme) {
7171

7272
build_legend <- function(name, mapping, layers, default_mapping, theme) {
7373
legend_data <- llply(layers, build_legend_data, mapping, default_mapping)
74-
# if (length(legend_data) == 0) return(nullGrob())
74+
# if (length(legend_data) == 0) return(zeroGrob())
7575
# browser()
7676

7777
# Calculate sizes for keys - mainly for v. large points and lines

R/layer.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ Layer <- proto(expr = {
233233
}
234234

235235
make_grob <- function(., data, scales, cs) {
236-
if (empty(data)) return(nullGrob())
236+
if (empty(data)) return(zeroGrob())
237237
data <- .$use_defaults(data)
238238

239239
check_required_aesthetics(.$geom$required_aes, c(names(data), names(.$geom_params)), paste("geom_", .$geom$objname, sep=""))

0 commit comments

Comments
 (0)