mplot3
: BarplotDraw barplots
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,
...)
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.
Vector of colors to use
Float: Alpha to be applied to col
Color if you wish to draw border around bars, NA for no borders (Default)
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
Float vector, length 2: x-axis limits
Float vector, length 2: y-axis limits
String: x-axis label
Adjustment for the x axis label position (See codeline in ?mtext
)
String: y-axis label
Similar to xlab.line
for the y axis
String: Plot title
Float: mtext line
argument for the title. Higher numbers move title upwards.
Default = .5
Float: Plot title alignment (0 = left, .5 = center, 1 = right)
Color for title. Defaults to black for theme "light" and "box", otherwise white
Integer: 1: regular, 2: bold, 3: italic. See par("font")
for more
String: Font family to use. See par("family")
(Optional) If multiple groups are plotted, use these names if group.title = TRUE
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
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)
)
Vector, length 4: Margins; see mar
in ?par
"s" gives a square plot, "m" gives a plot that fills graphics device size. Defaults to "s"
(See ?par
)
Float: Character expansion factor (See ?par
)
Background color. Defaults to white for themes "light" and "box", black otherwise.
Similar to x.axis.padj
for the y axis
Float: Tick length. Can be negative (See ?par("tck")
)
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')
String: Color for axes values (box color set with box.col
)
Logical: Should grid be drawn?
Integer: N of grid lines on the y axis
Use with caution, probably along with yaxs = "i"
Grid line type (See ?par("lty")
)
Grid line width
Grid color
Alpha for grid.col
Additional arguments to graphics::barplot