Learn R Programming

plotrix (version 2.1-5)

gap.plot: Display a plot with a gap (missing range) on one axis

Description

Displays a plot with a missing range.

Usage

gap.plot(x,y,gap,gap.axis="y",xaxlab,xtics=NA,
  yaxlab,ytics=NA,col=par("col"),xlim,ylim,axes=FALSE,...)

Arguments

x,y
data values
gap
the range of values to be left out
gap.axis
whether the gap is to be on the x or y axis
xaxlab
labels for the x axis ticks
xtics
position of the x axis ticks
yaxlab
labels for the y axis ticks
ytics
position of the y axis ticks
col
color(s) in which to plot the values
xlim,ylim
the plot limits.
axes
logical - use the default axes or not.
...
arguments passed to plot.

Value

  • nil

Details

Displays a plot omitting a range of values on one axis. Typically used when there is a relatively large gap in the overall range of one set of values. The function warns the user if any values have been omitted by being in the "gap". See axis.break for a brief discussion of plotting on discontinuous coordinates.

See Also

gap.barplot

Examples

Run this code
twogrp<-c(rnorm(5)+4,rnorm(5)+20,rnorm(5)+5,rnorm(5)+24)
 gpcol<-c(2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5)
 gap.plot(twogrp,gap=c(8,16),xlab="Index",ylab="Group values",
  main="Plot gap on Y axis",col=gpcol)
 if(dev.interactive()) par(ask=TRUE)
 gap.plot(twogrp,rnorm(20),gap=c(8,16),gap.axis="x",xlab="X values",
  xtics=c(4,7,17,20),ylab="Y values",main="Plot gap on X axis") 
 par(ask=FALSE)

Run the code above in your browser using DataLab