bp: Function bp

bpR Documentation

Function bp

Description

Custom barplot with labeled bars.

Usage

bp(
  x = NULL,
  sd = NULL,
  cex = 1,
  beside = T,
  horiz = F,
  breakLabels = F,
  add.numbers = F,
  ndigits = 2,
  ncex = NA,
  nsrt = 0,
  npos = NA,
  ncol = "black",
  sdcol = "grey",
  grid = T,
  plot = T,
  main = NULL,
  sub = NULL,
  xlim.factor = 1.5,
  las = 1,
  srt = 45,
  xlim = NULL,
  ylim = NULL,
  names.arg = NULL,
  legend.text = NULL,
  optimize.legend = T,
  args.legend = NULL,
  density = NULL,
  angle = 45,
  col = NULL,
  grid.col = "grey",
  axes = T,
  add = F,
  adj = 0.5,
  default.labels = F,
  xlab = NA,
  ylab = NA,
  border = NA,
  grid.mode = 0,
  main1 = NULL,
  main2 = NULL,
  main3 = NULL,
  adj.main1 = 0,
  adj.main2 = 0,
  adj.main3 = 0,
  col.main1 = "black",
  col.main2 = "black",
  col.main3 = "black",
  cex.main1 = 1.2,
  cex.main2 = 1.2,
  cex.main3 = 1.2,
  font.main1 = 1,
  font.main2 = 2,
  font.main3 = 4,
  omitZeros = T,
  mar = NA,
  automar = F,
  ...
)

Arguments

x

Numeric vector, matrix or data.frame containing the values to be displayed.

sd

Numeric vector, matrix or data.frame of same format as x containing standard deviations.

cex

Size of axis fonts. Defaults to 1.

beside

Logical value indicating if bars should be placed next to each other. Defaults to T.

horiz

Logical value indicating if bars should be placed horizontal. Defaults to F.

breakLabels

Logical value indicating if labels of bars should be tranformed by quantqual::labelbreaker. Defaults to F.

add.numbers

Logical value indicating if numbers should be placed above bars. Defaults to F.

ndigits

Numeric value specifying the number of digits to be plotted (if add.numbers==T). Defaults to 2.

ncex

Size of fonts. If NA (default) is set to cex.

nsrt

Numeric value specifying the rotation of the numbers (between 0 and 360 degrees). Defaults to 0.

npos

Numeric value specifying the position of numbers. If NA (default) it is determined automatically.

ncol

Vector containing the color of bars. Defaults to "black".

sdcol

Vector containing the color of arrows. Defaults to "grey".

grid

Logical value indicating whether to plot a grid. Defaults to T.

plot

Logical value indicating whether to plot the barplot. Defaults to T.

main

Character vector with one element containing the barplot's title. Defaults to NULL

sub

Character vector with one element containing the barplot's subtitle. Defaults to NULL

xlim.factor

Numeric value for adding extra space to the right of the barplot (if a legend is provided). Defaults to 1.5

las

Numeric value specifying the rotation of the y-axis (0 for 90 percent rotation, 1 for 0 percent rotation). Defaults to 1.

srt

Numeric value specifying the rotation of the x-axis (between 0 and 360 degrees). Defaults to 45.

xlim

Numeric vector containing xlim.

names.arg

Character vector containing names of bars. If NULL (default) colnames of x will be applied as names.arg.

legend.text

Legend text. Set to NA or to F to supress legend. If NULL (default) rownames of x will be applied as legend.text.

optimize.legend

Logical or character value. If T (Default), the legend is shifted to the right if overlapping with bars (as long as no args.legend are provided). If a position is provided instead ("bottom", "bottomleft", "left","topleft","top","topright","right","bottomright") the legend will be placed and shifted accordingly. Adding a "1" at the end of a position (e.g., "top1") results in the legend being drawn horizontally instead of vertically.

args.legend

List with arguments to pass to legend(). Defaults to list(bg = "white").

density

Vector giving the density of shading lines, in lines per inch, for the bars or bar components. The default value of NULL means that no shading lines are drawn. Non-positive values of density also inhibit the drawing of shading lines.

angle

Slope of shading lines, given as an angle in degrees (counter-clockwise), for the bars or bar components.

col

Vector containing the color of bars. If NULL (default) colors are generated based on the rainbow-palette.

grid.col

Character or rgb value containing the color of grid lines. Defaults to "grey".

axes

Logical value indicating whether to plot axes. Defaults to T.

add

Logical value indicating whether to plot the barplot to the current device. Defaults to F.

adj

Numeric value between 0 and 1, indicating where to plot main title and axis labels - if any - between left (0) and right (1). Defaults to 0.5

default.labels

Logical value, indicating whether to use traditional barplot-labels (which, e.g., hide in case of overlap) instead of bp-style labels. Defaults to F.

xlab

Character value representing the label to be drawn next to the x-axis. Defaults to NA.

ylab

Character value representing the label to be drawn next to the y-axis. Defaults to NA.

border

Color of the bars' border. Defaults to NA.

grid.mode

Numeric value specifying when to plot the grid. 0 for grid in the background, 1 for grid in the foreground. Defaults to 0.

...

Additional graphical parameters for barplot.

Details

Plots a barplot and adds labels and numbers to bars. Optionally allows for plotting standard deviations around each bar.

Examples

bp(data.frame(group1=c(variable1=1,variable2=2),group2=c(variable1=3,variable2=4)),horiz=T,main="Example")

AndreasFischer1985/quantqual documentation built on June 20, 2022, 4:55 p.m.