mplot3_x | R Documentation |
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("density", "histogram", "hd", "lhist", "index", "ts", "qqline"),
group = NULL,
data = NULL,
xlab = NULL,
ylab = NULL,
main = NULL,
xlim = NULL,
ylim = NULL,
index.ypad = 0.1,
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.probability = FALSE,
hist.lwd = 3,
density.line = FALSE,
density.shade = TRUE,
density.legend.side = 3,
density.legend.adj = 0.98,
density.bw = "nrd0",
density.kernel = "gaussian",
density.params = list(na.rm = na.rm),
qqline.col = "#18A3AC",
qqline.alpha = 1,
pch = 16,
point.col = NULL,
point.cex = 1,
point.bg.col = NULL,
point.alpha = 0.66,
hline = NULL,
vline = NULL,
diagonal = FALSE,
grid = FALSE,
grid.col = NULL,
grid.alpha = 0.5,
grid.lty = 3,
grid.lwd = 1,
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",
x.axis.padj = -1.1,
y.axis.padj = 0.9,
labs.col = NULL,
lab.adj = 0.5,
density.avg = ifelse(type == "density", TRUE, FALSE),
density.avg.fn = c("median", "mean"),
density.avg.line = FALSE,
density.avg.lwd = 1.5,
density.avg.lty = 3,
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 = rtTheme,
palette = rtPalette,
pty = "m",
mar = NULL,
oma = rep(0, 4),
xaxs = "r",
yaxs = "r",
autolabel = letters,
new = FALSE,
alpha.off = FALSE,
na.rm = TRUE,
par.reset = TRUE,
filename = NULL,
pdf.width = 6,
pdf.height = 6,
...
)
x |
Numeric vector or list of vectors, one for each group.
If |
type |
Character: "density", "histogram", "hd" (histogram bars & density lines),
"lhist" (line histogram like mhist; same as |
group |
Vector denoting group membership. Will be converted to factor.
If |
data |
Optional data frame containing x data |
xlab |
Character: x-axis label |
ylab |
Character: y-axis label |
main |
Character: Plot title |
xlim |
Float vector, length 2: x-axis limits |
ylim |
Float vector, length 2: y-axis limits |
index.ypad |
Float: Expand ylim by this much for plot type "index" Default = .1 (Stops points being cut off) |
index.type |
Character: "p" for points (Default), "l" for lines (timeseries) |
hist.breaks |
See |
hist.type |
Character: "bars" or "lines". Default = "bars" |
hist.lwd |
Float: Line width for |
density.line |
Logical: If TRUE, draw line for |
density.shade |
Logical: If TRUE, draw shaded polygon for |
qqline.col |
Color for Q-Q line |
qqline.alpha |
Float: Alpha for Q-Q line |
pch |
Integer: Point character. |
point.cex |
Float: Character expansion for points. |
point.bg.col |
Color: point background |
hline |
Vector: y-value(s) for horizontal lines. |
vline |
Vector: x-value(s) for vertical lines. |
diagonal |
Logical: If TRUE, draw diagonal line. |
annotation |
Character: Add annotation at the bottom right of the plot |
group.legend |
Logical: If TRUE, include legend with group names |
group.title |
Character: Title above group names |
group.names |
(Optional) If multiple groups are plotted, use these
names if |
group.side |
Integer: Side to show group legend |
group.adj |
Float: |
group.at |
Float: location for group legend. See |
line.col |
Color for lines |
labs.col |
Color for labels |
lab.adj |
Adjust the axes labels. 0 = left adjust; 1 = right adjust; .5 = center (Default) |
density.avg |
Logical: If TRUE, print mean of |
density.avg.fn |
Character: "median" or "mean". Function to use if
|
density.avg.line |
Logical: If TRUE, draw vertical lines at the density average x-value |
density.avg.lwd |
Float: Line width for |
density.avg.lty |
Integer: Line type for |
hline.col |
Color for horizontal line(s) |
hline.lwd |
Float: Width for horizontal line(s) |
hline.lty |
Integer: Line type for horizontal line(s) |
vline.col |
Color for vertical lines |
vline.lwd |
Float: Width for vertical lines |
vline.lty |
Integer: Line type for vertical lines |
lty |
Integer: Line type. See |
lwd |
Integer: Line width. Used for |
theme |
Character: Run |
palette |
Vector of colors, or Character defining a builtin palette -
get options with |
pty |
Character: "s" gives a square plot; "m" gives a plot that fills
graphics device size. Default = "m" (See |
mar |
Float, vector, length 4: Margins; see |
oma |
Float, vector, length 4: Outer margins; see |
xaxs |
Character: "r": Extend plot x-axis limits by 4% on either end; "i": Use exact x-axis limits. |
yaxs |
Character: as |
autolabel |
Character vector to be used to generate autolabels when using
rtlayout with |
new |
Logical: If TRUE, add plot to existing plot. See |
na.rm |
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 |
par.reset |
Logical: If TRUE, reset |
filename |
Path to file: If supplied, plot will be printed to file |
pdf.width |
Float: Width in inches for pdf output (if |
pdf.height |
Float: Height in inches for pdf output. |
... |
Additional arguments to be passed to theme 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
Invisibly returns the output of density
, hist
, qqnorm
, or NULL
E.D. Gennatas
mplot3_xy, mplot3_xym, mplot3_heatmap
## Not run:
mplot3_x(iris)
mplot3_x(split(iris$Sepal.Length, iris$Species), xlab = "Sepal Length")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.