brokenBarplot: Make a barplot with a broken Y axis

View source: R/brokenBarplot.R

brokenBarplotR Documentation

Make a barplot with a broken Y axis

Description

Make a barplot with a broken Y axis

Usage

brokenBarplot(
  height,
  ylim1,
  yAxis1 = list(),
  ylim2,
  yAxis2 = list(),
  names.arg = NULL,
  ...
)

Arguments

height

Typical height parameter from barplot.

ylim1

Limits Y axis of the top plot.

yAxis1

Arguments passed to axis (Y axis) for the top plot.

ylim2

Limits Y axis of the bottom plot.

yAxis2

Arguments passed to axis (Y axis) for the bottom plot.

names.arg

Typical names.arg parameter from barplot.

...

Extra arguments passed to barplot.

Examples

n <- 10
myData <- data.frame(x = letters[1:n], y = runif(n = n, min = 0, max = 50))
index <- c(3, 4, 8)
myData$y[index] <- runif(n = 3, min = 500, max = 1000)

brokenBarplot(height = myData$y, names.arg = myData$x,
              ylim1 = c(0, 50),
              yAxis1 = list(at = seq(0, 50, 10), las = 2),
              ylim2 = c(500, 1000),
              yAxis2 = list(at = seq(500, 1000, 100), las = 2))

LuisLauM/ruisu documentation built on March 26, 2024, 8:23 a.m.