geom_vline {ggplot2}R Documentation

geom\_vline

Description

Line, vertical

Usage

geom_vline(mapping = NULL, data = NULL, stat = "vline", position = "identity", 
    ...)

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

...

ignored

Details

This geom allows you to annotate the plot with vertical lines (see geom\_hline and geom\_abline for other types of lines)

There are two ways to use it. You can either specify the intercept of the line in the call to the geom, in which case the line will be in the same position in every panel. Alternatively, you can supply a different intercept for each panel using a data.frame. See the examples for the differences

This page describes geom\_vline, 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\_vline. Aesthetics are mapped to variables in the data with the aes function: geom\_vline(aes(x = var))

Author(s)

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

See Also

Examples

## Not run: 
# Fixed lines
p <- ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point()
p + geom_vline(xintercept = 5)
p + geom_vline(xintercept = 1:5)
p + geom_vline(xintercept = 1:5, colour="green")

last_plot() + coord_equal()
last_plot() + coord_flip()

p2 <- p + aes(colour = factor(cyl))
p2 + geom_vline(xintercept = 15)

## End(Not run)

[Package ggplot2 version 0.8.9 Index]