Skip to content

Commit c104bfd

Browse files
committed
Close #2220: provide a default if the fatten param is missing in to_basic.GeomCrossbar
1 parent 2211ab7 commit c104bfd

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

R/layers2traces.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ to_basic.GeomCrossbar <- function(data, prestats_data, layout, params, p, ...) {
562562
# from GeomCrossbar$draw_panel()
563563
middle <- base::transform(data, x = xmin, xend = xmax, yend = y, alpha = NA)
564564
nm <- linewidth_or_size(GeomCrossbar)
565-
data[[nm]] <- data[[nm]] * params$fatten
565+
data[[nm]] <- data[[nm]] * (params$fatten %||% formals(geom_crossbar)$fatten)
566566
list(
567567
prefix_class(to_basic.GeomRect(data), "GeomCrossbar"),
568568
prefix_class(to_basic.GeomSegment(middle), "GeomCrossbar")

tests/testthat/test-ggplot-summary.R

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
test_that("stat_summary works", {
2+
p <- ggplot(iris, aes(x = Species, y = Sepal.Length)) +
3+
stat_summary(fun = mean, fun.max = max, fun.min = min) +
4+
stat_summary(fun = median, geom = "crossbar", linetype = "dashed")
5+
6+
expect_doppelganger_built(p, "stat-summary")
7+
})

0 commit comments

Comments
 (0)