gap.barp<-function (y,gap,xaxlab,xtics,yaxlab,ytics,xlim=NA,ylim=NA,
 xlab=NULL,ylab=NULL,main=NULL,horiz=FALSE,col=NULL,...) {
 if (missing(y)) stop("y values required")
 if(missing(xtics)) xtics <- 1:length(y)
 if (missing(gap)) stop("gap must be specified")
 if (is.null(ylab)) ylab <- deparse(substitute(y))
 if (is.null(col)) col <- color.gradient(c(0,1),c(0,1,0),c(1,0),length(y))
 else if(length(col) < length(y)) rep(col,length.out=length(y))
 littleones <- which(y <= gap[1])
 bigones <- which(y >= gap[2])
 valid.y<-y[!is.na(y)]
 if(any(valid.y > gap[1] & valid.y < gap[2]))
  warning("gap includes some values of y")
 gapsize <- gap[2] - gap[1]
 if(missing(xaxlab)) xaxlab <- as.character(xtics)
 if(is.na(xlim[1])) xlim <- range(xtics)
 if(is.na(ylim[1])) ylim <- c(min(valid.y),max(valid.y) - gapsize)
 if(missing(ytics)) ytics <- pretty(y)
 bigtics<-which(ytics>gap[2])
 if(missing(yaxlab)) yaxlab <- ytics
 ytics[bigtics]<-ytics[bigtics]-gapsize
 y[bigones]<-y[bigones]-gapsize
 barp(y,names.arg=xaxlab,col=col,xlab=xlab,ylab=ylab,height.at=ytics,
  height.lab=yaxlab,main=main,...)
 axis.break(2,gap[1],style="gap")
 invisible(y)
}
