geom_stepgeom_step(mapping=NULL, data=NULL, stat="identity", position="identity", direction="hv", ...)
Connect observations by stairs
Equivalent to plot(type='s').This page describes geom_step, see layer and qplot for how to create a complete plot from individual components.
What do you think of the documentation? Please let me know by filling out this short online survey.
The following aesthetics can be used with geom_step. Aesthetics are mapped to variables in the data with the aes function: geom_step(aes(x = var)). Note that you do not need quotes around the variable name.
Scales control how the variable is mapped to the aesthetic and are listed after each aesthetic.
| Aesthetic | Default | Related scales |
|---|---|---|
| colour | black | brewer, gradient, gradient2, gradientn, grey, hue, identity, manual |
| size | 0.5 | identity, manual, size |
| linetype | 1 | identity, linetype, manual |
| alpha | 1 |
Layers are divided into groups by the group aesthetic. By default this is set to the interaction of all categorical variables present in the plot.
Parameters control the appearance of the geom. In addition to the parameters listed below (if any), any aesthetic can be used as a parameter, in which case it will override any aesthetic mapping.
direction: direction of stairs: 'vh' for vertical then horizontal, or 'hv' for horizontal then verticalThis function returns a layer object.
> # Simple quantiles/ECDF from examples(plot) > x <- sort(rnorm(47)) > qplot(seq_along(x), x, geom="step")> > # Steps go horizontally, then vertically (default) > qplot(seq_along(x), x, geom="step", direction = "hv")
> plot(x, type = "s") > # Steps go vertically, then horizontally > qplot(seq_along(x), x, geom="step", direction = "vh")
> plot(x, type = "S") > > # Also works with other aesthetics > df <- data.frame( + x = sort(rnorm(50)), + trt = sample(c("a", "b"), 50, rep = T) + ) > qplot(seq_along(x), x, data = df, geom="step", colour = trt)
![]()
What do you think of the documentation? Please let me know by filling out this short online survey.