Skip to content

Commit c86ed7b

Browse files
Add rename_size = TRUE to GeomBar (#4939)
1 parent b4d8521 commit c86ed7b

File tree

2 files changed

+4
-45
lines changed

2 files changed

+4
-45
lines changed

R/geom-bar.r

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,5 +164,6 @@ GeomBar <- ggproto("GeomBar", GeomRect,
164164
lineend = lineend,
165165
linejoin = linejoin
166166
)
167-
}
167+
},
168+
rename_size = TRUE
168169
)

R/geom-col.r

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -31,47 +31,5 @@ geom_col <- function(mapping = NULL, data = NULL,
3131
#' @usage NULL
3232
#' @export
3333
#' @include geom-rect.r
34-
GeomCol <- ggproto("GeomCol", GeomRect,
35-
required_aes = c("x", "y"),
36-
37-
# These aes columns are created by setup_data(). They need to be listed here so
38-
# that GeomRect$handle_na() properly removes any bars that fall outside the defined
39-
# limits, not just those for which x and y are outside the limits
40-
non_missing_aes = c("xmin", "xmax", "ymin", "ymax"),
41-
42-
setup_params = function(data, params) {
43-
params$flipped_aes <- has_flipped_aes(data, params)
44-
params
45-
},
46-
47-
extra_params = c("just", "na.rm", "orientation"),
48-
49-
setup_data = function(data, params) {
50-
data$flipped_aes <- params$flipped_aes
51-
data <- flip_data(data, params$flipped_aes)
52-
data$width <- data$width %||%
53-
params$width %||% (resolution(data$x, FALSE) * 0.9)
54-
data$just <- params$just %||% 0.5
55-
data <- transform(
56-
data,
57-
ymin = pmin(y, 0), ymax = pmax(y, 0),
58-
xmin = x - width * (1 - just), xmax = x + width * just,
59-
width = NULL, just = NULL
60-
)
61-
flip_data(data, params$flipped_aes)
62-
},
63-
64-
draw_panel = function(self, data, panel_params, coord, lineend = "butt",
65-
linejoin = "mitre", width = NULL, flipped_aes = FALSE) {
66-
# Hack to ensure that width is detected as a parameter
67-
ggproto_parent(GeomRect, self)$draw_panel(
68-
data,
69-
panel_params,
70-
coord,
71-
lineend = lineend,
72-
linejoin = linejoin
73-
)
74-
},
75-
76-
rename_size = TRUE
77-
)
34+
# TODO: deprecate this
35+
GeomCol <- ggproto("GeomCol", GeomBar)

0 commit comments

Comments
 (0)