2222# ' @inheritParams layer
2323# ' @inheritParams geom_bar
2424# ' @param outline.type Type of the outline of the area; `"both"` draws both the
25- # ' upper and lower lines, `"upper"` draws the upper lines only. `"legacy"`
26- # ' draws a closed polygon around the area.
25+ # ' upper and lower lines, `"upper"`/`"lower"` draws the either lines only.
26+ # ' `"legacy"` draws a closed polygon around the area.
2727# ' @export
2828# ' @examples
2929# ' # Generate data
@@ -49,7 +49,7 @@ geom_ribbon <- function(mapping = NULL, data = NULL,
4949 show.legend = NA ,
5050 inherit.aes = TRUE ,
5151 outline.type = " both" ) {
52- outline.type <- match.arg(outline.type , c(" both" , " upper" , " legacy" ))
52+ outline.type <- match.arg(outline.type , c(" both" , " upper" , " lower " , " legacy" ))
5353
5454 layer(
5555 data = data ,
@@ -158,6 +158,7 @@ GeomRibbon <- ggproto("GeomRibbon", Geom,
158158 munched_lines $ id <- switch (outline.type ,
159159 both = munched_lines $ id + rep(c(0 , max(ids , na.rm = TRUE )), each = length(ids )),
160160 upper = munched_lines $ id + rep(c(0 , NA ), each = length(ids )),
161+ lower = munched_lines $ id + rep(c(NA , 0 ), each = length(ids )),
161162 abort(glue(" invalid outline.type: {outline.type}" ))
162163 )
163164 g_lines <- polylineGrob(
@@ -180,7 +181,7 @@ geom_area <- function(mapping = NULL, data = NULL, stat = "identity",
180181 position = " stack" , na.rm = FALSE , orientation = NA ,
181182 show.legend = NA , inherit.aes = TRUE , ... ,
182183 outline.type = " upper" ) {
183- outline.type <- match.arg(outline.type , c(" both" , " upper" , " legacy" ))
184+ outline.type <- match.arg(outline.type , c(" both" , " upper" , " lower " , " legacy" ))
184185
185186 layer(
186187 data = data ,
0 commit comments