Calculates the spaces between bars of widths w at positions x as difference between the x values minus half the width of the bars/bar groups.

hsBpSpace(
  myWidth,
  position,
  myXlim = NULL,
  myBeside = FALSE,
  barsPerGroup = 1,
  innerSpace = 0,
  dbg = FALSE
)

Arguments

myWidth

Bar widths. If bars are to be stacked (isp = NULL, see below) w represents the widths of the different (stacked) bars. If bars are to be arranged side by side (isp >= 0) w represents the widths of the bars within one and the same bar group. Corresponding bars of different groups will always have the same width.

position

X-positions of bars/bar groups

myXlim

Vector containing minimum and maximum x-value to be shown in the plot.

myBeside

If TRUE, bars of a bar group are not stacked but arranged side by side. Then, myWidth contains the widths of the bars within one group. Otherwise (myBeside = FALSE) myWidth contains the widths of the (stacked) bars.

barsPerGroup

Number of bars per group. If this parameter is greater than 1, it means that bars are to be arranged side by side instead of stacked.

innerSpace

"Inner" space between bars of the same group (only used if bpg > 1).

dbg

whether to print debug messages or not

Value

Returns a space vector as needed to be passed to the barplot function