Learn R Programming

ggcyto (version 1.0.5)

geom_hvline: Vertical or horizontal line.

Description

This geom is based on the source code of ' geom_hline and geom_vline.

Usage

geom_hvline(mapping = NULL, data = NULL, position = "identity", show.legend = FALSE, ...)

Arguments

mapping
The aesthetic mapping, usually constructed with aes or aes_string. Only needs to be set at the layer level if you are overriding the plot defaults.
data
A layer specific dataset - only needed if you want to override the plot defaults.
position
The position adjustment to use for overlapping points on this layer
show.legend
should a legend be drawn? (defaults to FALSE)
...
other arguments passed on to layer. This can include aesthetics whose values you want to set, not map. See layer for more details.

Value

a geom_hvline layer

Aesthetics

geom_vline understands the following aesthetics (required aesthetics are in bold):
  • xintercept
  • alpha
  • colour
  • linetype
  • size

Details

The goal is to determine the line to be either vertial or horizontal based on the 1-d data provided in this layer.

Examples

Run this code
p <- ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point()
# vline
p + geom_hvline(data = data.frame(wt= 3))
# hline
p + geom_hvline(data = data.frame(mpg= 20))

Run the code above in your browser using DataLab