mplot3
: Univariate plots: index, histogram, density, QQ-lineDraw plots of 1-dimensional data: index, histogram, density, and Q-Q plots.
mplot3.x(x, type = c("index", "line", "histogram", "density", "qqline"),
group = NULL, data = NULL, xlab = NULL, ylab = NULL,
main = NULL, main.col = NULL, main.adj = 0, main.line = 0.5,
main.font = 2, main.family = "", xlim = NULL, ylim = NULL,
index.ypad = 0.1, axes = TRUE, axes.swap = FALSE,
axes.col = NULL, tick.col = NULL, cex = 1.2, col = NULL,
alpha = 0.75, index.type = c("p", "l"), hist.breaks = "Sturges",
hist.type = c("bars", "lines"), hist.lwd = 3, density.line = FALSE,
density.shade = TRUE, density.legend.side = 3,
density.legend.adj = 0.98, density.params = list(),
qqline.col = NULL, qqline.alpha = 0.66, pch = 16,
point.col = NULL, point.cex = 1, point.bg.col = NULL,
point.alpha = 0.66, hline = NULL, vline = NULL, diagonal = FALSE,
diagonal.col = NULL, grid = FALSE, grid.col = NULL,
grid.alpha = 0.5, grid.lty = 3, grid.lwd = 1, bg = NULL,
plot.bg = NULL, annotation = NULL, annot.col = NULL,
group.legend = NULL, group.title = "", group.names = NULL,
group.side = 3, group.adj = 0.02, group.at = NA, text.xy = NULL,
text.x = NULL, text.y = NULL, text.xy.cex = 1,
text.xy.col = "white", line.col = "#008E00", tck = 0.02,
x.axis.padj = -1.1, xlab.line = 1.3, y.axis.padj = 0.9,
ylab.line = 1.6, labs.col = NULL, bty = "o", box = NULL,
box.col = NULL, box.alpha = 1, box.lty = 1, box.lwd = 2,
lab.adj = 0.5, density.mean = ifelse(type == "density", TRUE, FALSE),
hline.col = "black", hline.lwd = 1, hline.lty = 1,
vline.col = "black", vline.lwd = 1, vline.lty = 1, lty = 1,
lwd = 2, qqline.lwd = lwd, density.lwd = lwd,
theme = getOption("rt.theme", "lightgrid"),
palette = getOption("rt.palette", "rtCol1"), zero.lines = NULL,
zero.col = NULL, zero.alpha = 0.66, zero.lty = 1, zero.lwd = 1.5,
pty = "s", mar = c(2.5, 2.5, 1.5, 1), xaxs = "r", yaxs = "r",
autolabel = letters, new = FALSE, alpha.off = FALSE,
na.rm = TRUE, par.reset = TRUE, export.par.orig = FALSE,
filename = NULL, pdf.width = 6, pdf.height = 6, ...)
Numeric vector or list of vectors, one for each group.
If data
is provided, x is name of variable in data
String:"index", "line", "histogram", "density", "qqline"
Case-insensitive and supports partial matching: e.g. mplot3.x(x, "H")
gives histogram
Vector denoting group membership. Will be converted to factor.
If data
is provided, group
is name of variable if data
Optional data frame containing x data
String: x-axis label
String: y-axis label
String: Plot title
Color for title. Defaults to black for theme "light" and "box", otherwise white
Float: Plot title alignment (0 = left, .5 = center, 1 = right)
Float: mtext line
argument for the title. Higher numbers move title upwards.
Default = .5
Integer: 1: regular, 2: bold, 3: italic. See par("font")
for more
String: Font family to use. See par("family")
Float vector, length 2: x-axis limits
Float vector, length 2: y-axis limits
Float: Expand ylim by this much for plot type "index" Default = .1 (Stops points being cut off)
Logical: Should the axes be drawn? Defaults to TRUE
String: Color for axes values (box color set with box.col
)
Float: Character expansion factor (See ?par
)
String: "p" for points (Default), "l" for lines (timeseries)
See histogram("breaks")
String: "bars" or "lines"
Float: Line width for type = "histogram"
; hist.type = "lines"
Logical: If TRUE, draw line for type = "density"
. Default = FALSE
Logical: If TRUE, draw shaded polygon for type = "density"
. Default = TRUE
Color for Q-Q line
Float: Alpha for Q-Q line
Logical: Should grid be drawn?
Grid color
Alpha for grid.col
Grid line type (See ?par("lty")
)
Grid line width
Background color. Defaults to white for themes "light" and "box", black otherwise.
String: Add annotation at the bottom right of the plot
Logical: If TRUE, include legend with group names
String: Title above group names
(Optional) If multiple groups are plotted, use these names if group.title = TRUE
Float: Tick length. Can be negative (See ?par("tck")
)
Adjustment for the x axis tick labels position
Adjustment for the x axis label position (See codeline in ?mtext
)
Similar to x.axis.padj
for the y axis
Similar to xlab.line
for the y axis
Color for labels
Character: "o", "l", "7", "c", "u", or "]" result in a box resembling each character.
(See ?par
)
Logical: Should a box be drawn around the plot? Defaults to TRUE for themes "box" and "darkbox"
Box color
Alpha for box.col
Box line type
Adjust the axes labels. 0 = left adjust; 1 = right adjust; .5 = center (Default)
Logical: If TRUE, print mean of x
along plot. Default = TRUE, for type = "density"
Integer: Line width. Used for type = "line" or "density"
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')
Logical: If TRUE, draw lines at x = 0 and y = 0
Color for zero.lines
Color alpha for zero.lines
Zero line line type
Zero line width
"s" gives a square plot, "m" gives a plot that fills graphics device size. Defaults to "s"
(See ?par
)
Vector, length 4: Margins; see mar
in ?par
Logical: If TRUE, add plot to existing plot. See par("new")
Logical: Will be passed to all functions that support it. If set to FALSE,
input containing NA values will result in error, depending on the type
Path to file: If supplied, plot will be printed to file
Additional arguments to be passed to learner function
You can group data either by supplying x as a list where each element contains one vector per group, or
as a data frame where each column represents group,
or by providing a group
variable, which will be converted to factor.
For bivariate plots, see mplot3.xy and mplot3.xym. For heatmaps, see mplot3.heatmap
To plot histograms of multiple groups, it's best to use hist.type = "lines"
, which will use mhist
and space apart the breaks for each group