ggplot2
ggplot2 copied to clipboard
Add `geom_step(orientation)` argument
This PR aims to fix #5936.
Briefly, it adds the orientation
argument to geom_step()
.
If orientation = "y"
, stairsteps are constructed vertically.
In the example below, recall that the steps go from top to bottom, so direction = "hv"
first does the horizontal step, then the vertical one (and vice versa for direciton = "vh"
).
devtools::load_all("~/packages/ggplot2/")
#> ℹ Loading ggplot2
recent <- economics[economics$date > as.Date("2013-01-01"), ]
ggplot(recent, aes(date, unemploy)) +
geom_point(shape = 21, size = 3, fill = "white") +
geom_step(aes(colour = "hv"), orientation = "y", direction = "hv") +
geom_step(aes(colour = "vh"), orientation = "y", direction = "vh") +
geom_step(aes(colour = "mid"),orientation = "y", direction = "mid")
Created on 2024-06-07 with reprex v2.1.0