Learn R Programming

rtemis (version 0.79)

mplot3.bar: mplot3: Barplot

Description

Draw barplots

Usage

mplot3.bar(x, error = NULL, col = NULL, error.col = "white",
  error.lwd = 2, alpha = 1, border = NA, width = 1, space = NULL,
  xlim = NULL, ylim = NULL, xlab = NULL, xlab.line = 1.5,
  ylab = NULL, ylab.line = 1.5, main = NULL, main.line = 0.5,
  main.adj = 0, main.col = NULL, main.font = 2, main.family = "",
  names.arg = NULL, axisnames = FALSE, las = 1.5,
  group.names = NULL, group.names.srt = 0,
  group.names.adj = ifelse(group.names.srt == 0, 0.5, 1),
  group.names.line = 0.5, group.names.font = 1, group.names.cex = 1,
  group.names.y.pad = 0.08, group.names.at = NULL,
  color.bygroup = FALSE, legend = FALSE, legend.names = NULL,
  legend.position = "topright", legend.inset = c(0, 0),
  toplabels = NULL, mar = c(3, 2.5, 2.5, 1), pty = "m", cex = 1.2,
  cex.axis = cex, cex.names = 1, bg = NULL, plot.bg = NULL,
  barplot.axes = FALSE, yaxis = TRUE, ylim.pad = 0.04,
  y.axis.padj = 1, tck = -0.015, tick.col = NULL,
  theme = getOption("rt.theme", "light"),
  palette = getOption("rt.palette", "rtCol1"), axes.col = NULL,
  labs.col = NULL, grid = FALSE, grid.ny = NULL, grid.lty = NULL,
  grid.lwd = NULL, grid.col = NULL, grid.alpha = 1,
  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.

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

String: x-axis label

xlab.line

Adjustment for the x axis label position (See codeline in ?mtext)

ylab

String: y-axis label

ylab.line

Similar to xlab.line for the y axis

main

String: Plot title

main.line

Float: mtext line argument for the title. Higher numbers move title upwards. Default = .5

main.adj

Float: Plot title alignment (0 = left, .5 = center, 1 = right)

main.col

Color for title. Defaults to black for theme "light" and "box", otherwise white

main.font

Integer: 1: regular, 2: bold, 3: italic. See par("font") for more

main.family

String: Font family to use. See par("family")

group.names

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

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

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))

mar

Vector, length 4: Margins; see mar in ?par

pty

"s" gives a square plot, "m" gives a plot that fills graphics device size. Defaults to "s" (See ?par)

cex

Float: Character expansion factor (See ?par)

bg

Background color. Defaults to white for themes "light" and "box", black otherwise.

y.axis.padj

Similar to x.axis.padj for the y axis

tck

Float: Tick length. Can be negative (See ?par("tck"))

theme

String: "light", "dark", "lightgrid", "darkgrid", "lightbox", "darkbox" Default = "lightgrid" if no default "rt.fit" is set using options. You can set a system-wide default in your .Rprofile by including a line like options(rt.theme = 'lightgrid')

axes.col

String: Color for axes values (box color set with box.col)

grid

Logical: Should grid be drawn?

grid.ny

Integer: N of grid lines on the y axis Use with caution, probably along with yaxs = "i"

grid.lty

Grid line type (See ?par("lty"))

grid.lwd

Grid line width

grid.col

Grid color

grid.alpha

Alpha for grid.col

...

Additional arguments to graphics::barplot