A geom that draws a step-function, for example to visualize an empirical cumulative distribution function.
Default statistic: stat_identity
Default position adjustment: position_identity
The plot below consists of three layers. The first two layers draw a step-function, the last draws the corresponding points. The first step function is drawn with direction="hv" (the default; horizontal followed by vertical part of the step), the second step function (based on exactly the same data) is drawn with direction="vh" (vertical followed by horizontal part of the step), using a dotted line style.
d=data.frame(x=c(1,2,4,5,7,8,9), y=c(1,2,3,5,6,7,9)) ggplot() + geom_step(data=d, mapping=aes(x=x, y=y)) + geom_step(data=d, mapping=aes(x=x, y=y), direction="vh", linetype=3) + geom_point(data=d, mapping=aes(x=x, y=y), color="red") + opts(title="geom_step", plot.title=theme_text(size=40, vjust=1.5))