Learn R Programming

plotrix (version 2.5-2)

dispersion: Display a measure of dispersion

Description

Display line/cap bars at specified points on a plot representing measures of dispersion.

Usage

dispersion(x,y,ulim,llim=ulim,arrow.cap=0.01,arrow.gap=NA,type="a",...)
 dispbars(x,y,ulim,llim=ulim,arrow.cap=0.01,arrow.gap=NA,...)

Arguments

x,y
x and y position of the centers of the bars
ulim,llim
The extent of the dispersion measures.
arrow.cap
The width of the cap at the outer end of each bar as a proportion of the width of the plot.
arrow.gap
The gap to leave at the inner end of each bar. Defaults to two thirds of the height of a capital "O".
type
What type of display to use.
...
additional arguments passed to arrows or lines depending upon type.

Value

  • nil

Details

dispersion displays a measure of dispersion on an existing plot. Currently it will display either vertical lines with caps (error bars) or lines that form a "confidence band" around a line of central tendency. dispbars is now a call to dispersion with type set to a. If arrow.gap is greater than or equal to the upper or lower limit for a bar, segments is used to draw the upper and lower caps with no bars to avoid zero length arrows.

See Also

arrows, segments,lines

Examples

Run this code
disptest<-matrix(rnorm(200),nrow=20)
 disptest.means<-rowMeans(disptest)
 row.order<-order(disptest.means)
 se.disptest<-unlist(apply(disptest,1,std.error))
 plot(disptest.means[row.order],main="Dispersion as error bars",
  ylim=c(min(disptest.means-se.disptest),max(disptest.means+se.disptest)),
  xlab="Occasion",ylab="Value")
 dispersion(1:20,disptest.means[row.order],se.disptest[row.order])
 plot(disptest.means[row.order],main="Dispersion as confidence band",
  ylim=c(min(disptest.means-se.disptest),max(disptest.means+se.disptest)),
  xlab="Occasion",ylab="Value")
 dispersion(1:20,disptest.means[row.order],se.disptest[row.order],type="l",lty=2)

Run the code above in your browser using DataLab