geom_step {ggplot2}R Documentation

geom_step

Description

Connect observations by stairs

Usage

geom_step(mapping=NULL, data=NULL, stat="identity", position="identity", direction="hv", ...)

Arguments

mapping mapping between variables and aesthetics generated by aes
data dataset used in this layer, if not specified uses plot dataset
stat statistic used by this layer
position position adjustment used by this layer
direction direction of stairs: 'vh' for vertical then horizontal, or 'hv' for horizontal then vertical
... other arguments

Details

Equivalent to plot(type='s').This page describes geom_step, see layer and qplot for how to create a complete plot from individual components.

Value

A layer

Aesthetics

The following aesthetics can be used with geom_step. Aesthetics are mapped to variables in the data with the aes function: geom\_step(\code{aes}(x = var))

Author(s)

Hadley Wickham, http://had.co.nz/

See Also

Examples

## Not run: 
# 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)

## End(Not run)

[Package ggplot2 version 0.8.2 Index]