mplot3_bar: 'mplot3': Barplot

View source: R/mplot3_bar.R

mplot3_barR Documentation

mplot3: Barplot

Description

Draw barplots

Usage

mplot3_bar(
  x,
  error = NULL,
  col = NULL,
  error.col = "white",
  error.lwd = 2,
  alpha = 1,
  beside = TRUE,
  border = NA,
  width = 1,
  space = NULL,
  xlim = NULL,
  ylim = NULL,
  xlab = NULL,
  ylab = NULL,
  main = NULL,
  las = 1.5,
  xnames = NULL,
  xnames.srt = 0,
  xnames.adj = ifelse(xnames.srt == 0, 0.5, 1),
  xnames.line = 0.5,
  xnames.font = 1,
  xnames.cex = 1,
  xnames.y.pad = 0.08,
  xnames.at = NULL,
  color.bygroup = FALSE,
  group.legend = NULL,
  legend.x = NULL,
  legend.y = NULL,
  group.names = NULL,
  legend.font = 1,
  bartoplabels = NULL,
  bartoplabels.line = 0,
  bartoplabels.font = 1,
  mar = c(2.5, 3, 2, 1),
  pty = "m",
  barplot.axes = FALSE,
  yaxis = TRUE,
  ylim.pad = 0.04,
  theme = rtTheme,
  palette = rtPalette,
  autolabel = letters,
  par.reset = TRUE,
  pdf.width = 6,
  pdf.height = 6,
  filename = NULL,
  ...
)

Arguments

x

Vector or Matrix: If Vector, each value will be drawn as a bar. If Matrix, each column is a vector, so multiple columns signify a different group. e.g. Columns could be months and rows could be N days sunshine, N days rainfall, N days snow, etc.

error

Vector or Matrix: If Vector, each value will be drawn as an error bar. If Matrix, each column is a vector, so multiple columns signify a different group.

col

Vector of colors to use

alpha

Float: Alpha to be applied to col

border

Color if you wish to draw border around bars, NA for no borders (Default)

space

Float: Space left free on either side of the bars, as a fraction of bar width. A single number or a vector, one value per bar. If x is a matrix, space can be length 2 vector, signifying space between bars within group and between groups. Default = c(0, 1) if x is matrix and beside = TRUE, otherwise Default = .2

xlim

Float vector, length 2: x-axis limits

ylim

Float vector, length 2: y-axis limits

xlab

Character: x-axis label

ylab

Character: y-axis label

main

Character: Plot title

color.bygroup

Logical: If TRUE, and input is a matrix, each group's bars will be given the same color, otherwise bars across groups will be given the same sequence of colors. Default = FALSE

group.legend

Logical: If TRUE, place group.names in a legend

group.names

(Optional) If multiple groups are plotted, use these names if group.title = TRUE

mar

Float, vector, length 4: Margins; see par("mar")

pty

Character: "s" gives a square plot; "m" gives a plot that fills graphics device size. Default = "m" (See par("pty"))

theme

Character: Run themes() for available themes

palette

Vector of colors, or Character defining a builtin palette - get options with rtpalette()

autolabel

Character vector to be used to generate autolabels when using rtlayout with autolabel = TRUE.

par.reset

Logical: If TRUE, reset par setting before exiting.

pdf.width

Float: Width in inches for pdf output (if filename is set).

pdf.height

Float: Height in inches for pdf output.

filename

Character: Path to file to save plot. Default = NULL

...

Additional arguments to graphics::barplot

legend

Logical: If TRUE, and input is matrix, draw legend for each case. Note: you may need to adjust mar and legend.inset if you want to place the legend outside the plot (can use e.g.legend.inset = c(-.5, 0))

Author(s)

E.D. Gennatas


egenn/rtemis documentation built on Dec. 17, 2024, 6:16 p.m.