Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

gap_barp

Display a barplot with a gap (missing range) on one axis


Description

Displays a barplot with a missing range.

Usage

gap_barp(height,gap,width=0.4,names.arg=names(height),
 col=NULL,main="",xlab="",ylab="",xlim=NULL,ylim=NULL,x=NULL,
 height.at=pretty(height),height.lab=NULL,...)

Arguments

height

a vector of data values

gap

the range of values to be left out

width

the proportion of bar width to bar spacing divided by 2. width=1 means no spaces between the bars.

names.arg

labels for the bars.

col

color(s) in which to plot the values

main

title for the plot.

xlab

label for the x axis

ylab

label for the y axis

xlim

Optional x limits for the plot

ylim

optional y limits for the plot

x

optional x positions for the bars.

height.at

explicit positions for the y axis ticks

height.lab

explicit labels for the y axis ticks.

...

arguments passed to barp.

Details

Displays a barplot omitting a range of values on the X or Y axis. Typically used when there is a relatively large gap in the range of values represented as bar heights. See axis.break for a brief discussion of plotting on discontinuous coordinates.

If the user does not ask for specific y limits, the function will calculate limits based on the range of the data values. If passing specific limits, remember to subtract the gap from the upper or lower limit.

Value

The center positions of the bars.

Author(s)

Jim Lemon

See Also

Examples

oneout<-c(rnorm(5,sd=5),20,rnorm(5,sd=5))
 gap_barp(oneout,gap=c(8,16),xlab="Index",height.at=c(-5,0,5,20),
  ylab="Group values",main="Barplot with gap above zero")
 oneout[6]<--20
 gap_barp(oneout,gap=c(-8,-16),xlab="Index",height.at=c(-20,-5,0,5),
  ylab="Group values",main="Barplot with gap below zero")

plotrix

Various Plotting Functions

v3.8-1
GPL (>= 2)
Authors
Jim Lemon, Ben Bolker, Sander Oom, Eduardo Klein, Barry Rowlingson, Hadley Wickham, Anupam Tyagi, Olivier Eterradossi, Gabor Grothendieck, Michael Toews, John Kane, Rolf Turner, Carl Witthoft, Julian Stander, Thomas Petzoldt, Remko Duursma, Elisa Biancotto, Ofir Levy, Christophe Dutang, Peter Solymos, Robby Engelmann, Michael Hecker, Felix Steinbeck, Hans Borchers, Henrik Singmann, Ted Toal, Derek Ogle, Darshan Baral, Ulrike Groemping, Bill Venables
Initial release
2021-01-21

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.