geom_linerange

An interval represented by a vertical line

Details

See layer and qplot for more information on creating a complete plot from multiple components.

Aesthetics

The following aesthetics can be used with geom_linerange. They are listed along with their default value. All geoms and scales can also use the group aesthetic. Read how this important aesthetic works in scale_group. Typically, you will associate an aesthetic with a variable in your data set. To do this, you use the aes function: geom_linerange(aes(x = var)). Scales control the details of the mapping between data and aesthetic properties; after each aesthetic are listed scales that can be used with that aesthetic. The scale documentation will also provide references to help you interpret the default values.

Instead of mapping an aesthetic to a variable in your dataset, you can also set it to a fixed value. See the parameters section for details.

Parameters

When an aesthetic is used an a parameter, like geom_linerange(colour = 3), it will override mappings from data.

Default statistic

stat_identity. Override with the stat argument: geom_linerange(stat="identity")

Default position

position_identity. Override with the position argument: geom_linerange(position="jitter").

See also

Examples


> dmod <- lm(price ~ cut, data=diamonds)
> cuts <- data.frame(cut=unique(diamonds$cut), predict(dmod, data.frame(cut = unique(diamonds$cut)), se=T)[c("fit","se.fit")])
> 
> qplot(cut, fit, data=cuts)


> # With a bar chart, we are comparing lengths, so the y-axis is
> # automatically extended to include 0
> qplot(cut, fit, data=cuts, geom="bar")


> 
> # Display estimates and standard errors in various ways
> qplot(cut, min=fit - se.fit, max=fit + se.fit, y=fit, data=cuts, geom="linerange")


> qplot(cut, min=fit - se.fit, max=fit + se.fit, y=fit, data=cuts, geom="pointrange")


> qplot(cut, min=fit - se.fit, max=fit + se.fit, y=fit, data=cuts, geom="errorbar", width=0.5)


> qplot(cut, min=fit - se.fit, max=fit + se.fit, y=fit, data=cuts, geom="crossbar", width=0.5)

 src 
"\n"