@@ -305,7 +305,8 @@ GeomLine <- ggproto("GeomLine", GeomPath,
305
305
# ' @rdname geom_path
306
306
geom_step <- function (mapping = NULL , data = NULL , stat = " identity" ,
307
307
position = " identity" , direction = " hv" ,
308
- na.rm = FALSE , show.legend = NA , inherit.aes = TRUE , ... ) {
308
+ na.rm = FALSE , orientation = NA , show.legend = NA ,
309
+ inherit.aes = TRUE , ... ) {
309
310
layer(
310
311
data = data ,
311
312
mapping = mapping ,
@@ -316,6 +317,7 @@ geom_step <- function(mapping = NULL, data = NULL, stat = "identity",
316
317
inherit.aes = inherit.aes ,
317
318
params = list2(
318
319
direction = direction ,
320
+ orientation = orientation ,
319
321
na.rm = na.rm ,
320
322
...
321
323
)
@@ -328,11 +330,21 @@ geom_step <- function(mapping = NULL, data = NULL, stat = "identity",
328
330
# ' @export
329
331
# ' @include geom-path.R
330
332
GeomStep <- ggproto(" GeomStep" , GeomPath ,
333
+ setup_params = function (data , params ) {
334
+ params $ flipped_aes <- has_flipped_aes(data , params , ambiguous = TRUE )
335
+ params
336
+ },
337
+ extra_params = c(" na.rm" , " orientation" ),
331
338
draw_panel = function (data , panel_params , coord ,
332
339
lineend = " butt" , linejoin = " round" , linemitre = 10 ,
333
340
arrow = NULL , arrow.fill = NULL ,
334
- direction = " hv" ) {
341
+ direction = " hv" , flipped_aes = FALSE ) {
342
+ data <- flip_data(data , flipped_aes )
343
+ if (isTRUE(flipped_aes )) {
344
+ direction <- switch (direction , hv = " vh" , vh = " hv" , direction )
345
+ }
335
346
data <- dapply(data , " group" , stairstep , direction = direction )
347
+ data <- flip_data(data , flipped_aes )
336
348
GeomPath $ draw_panel(
337
349
data , panel_params , coord ,
338
350
lineend = lineend , linejoin = linejoin , linemitre = linemitre ,
0 commit comments