Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ core developer team.

* `geom_rug()` now works with `coord_flip()` (@has2k1, #2987).

* `geom_violin()` no longer throws an error when quantile lines falls outside
the violin polygon (@thomasp85, #3254)

* Default labels are now generated more consistently; e.g., symbols no longer
get backticks, and long expressions are abbreviated with `...`
(@yutannihilation, #2981).
Expand Down
9 changes: 7 additions & 2 deletions R/geom-violin.r
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,17 @@ GeomViolin <- ggproto("GeomViolin", Geom,
quantiles <- create_quantile_segment_frame(data, draw_quantiles)
aesthetics <- data[
rep(1, nrow(quantiles)),
setdiff(names(data), c("x", "y")),
setdiff(names(data), c("x", "y", "group")),
drop = FALSE
]
aesthetics$alpha <- rep(1, nrow(quantiles))
both <- cbind(quantiles, aesthetics)
quantile_grob <- GeomPath$draw_panel(both, ...)
both <- both[!is.na(both$group), , drop = FALSE]
quantile_grob <- if (nrow(both) == 0) {
zeroGrob()
} else {
GeomPath$draw_panel(both, ...)
}

ggname("geom_violin", grobTree(
GeomPolygon$draw_panel(newdata, ...),
Expand Down