Learn R Programming

rtemis (version 0.79)

mplot3.xy: mplot3: XY Scatter and line plots

Description

Plot points and lines with optional fits and standard error bands

Usage

mplot3.xy(x, y, fit = NULL, formula = NULL, se.fit = FALSE,
  mod.params = NULL, error.x = NULL, error.y = NULL,
  cluster = NULL, cluster.params = list(), data = NULL,
  type = NULL, group = NULL, xlab = NULL, ylab = NULL,
  main = NULL, main.line = 0.5, main.adj = 0, main.col = NULL,
  main.font = 2, main.family = "", cex = 1.2, xlim = NULL,
  ylim = NULL, xpd = TRUE, xaxs = "r", yaxs = "r", rsq = NULL,
  rsq.pval = FALSE, rsq.side = 1, rsq.adj = 0.98,
  rsq.padj.shift = 0, rsq.col = NULL, fit.error = FALSE,
  fit.error.side = 1, fit.error.padj = NA, fit.error.col = NULL,
  xaxp = NULL, yaxp = NULL, scatter = TRUE, axes = TRUE,
  axes.equal = FALSE, axes.col = NULL, pty = "s", box = NULL,
  bty = "o", box.col = NULL, box.alpha = 1, box.lty = 1,
  box.lwd = 1.5, grid = FALSE, grid.nx = NULL, grid.ny = NULL,
  grid.col = NULL, grid.alpha = 1, grid.lty = 1, grid.lwd = 1.5,
  bg = NULL, plot.bg = NULL, annotation = NULL,
  annotation.col = NULL, tick.col = NULL, tck = 0.015,
  x.axis.side = 1, y.axis.side = 2, x.axis.at = NULL,
  y.axis.at = NULL, x.axis.labs = TRUE, y.axis.labs = TRUE,
  x.axis.padj = -1.1, xlab.line = 1.3, y.axis.padj = 0.9,
  ylab.line = 1.6, xlab.adj = 0.5, ylab.adj = 0.5, mar = c(2.5,
  2.5, 1.5, 1), col = NULL, pch = ifelse(is.null(point.bg.col), 16,
  21), point.cex = 0.85, point.col = NULL, point.bg.col = NULL,
  point.alpha = 0.66, line.col = NULL, line.alpha = 0.66, lty = 1,
  lwd = 2, marker.col = NULL, marker.alpha = 0.66,
  error.x.col = NULL, error.y.col = NULL, error.x.lty = 1,
  error.y.lty = 1, error.x.lwd = 1, error.y.lwd = 1,
  error.arrow.code = 3, fit.col = NULL, fit.lwd = 2.5,
  fit.alpha = 0.66, fit.legend = ifelse(is.null(fit), FALSE, TRUE),
  se.lty = "poly", se.lwd = 1, se.col = NULL, se.alpha = 0.5,
  se.times = 2, se.border = FALSE, se.density = NULL,
  xy.fit = NULL, xy.fit.col = NULL, firstpc = FALSE,
  firstpc.lty = 3, firstpc.col = NULL, hline = NULL,
  hline.col = NULL, hline.lwd = 1.5, hline.lty = 3, vline = NULL,
  vline.lwd = 1.5, vline.col = "blue", vline.lty = 3,
  diagonal = FALSE, diagonal.inv = FALSE, diagonal.lwd = 1.5,
  diagonal.lty = 1, diagonal.col = NULL, diagonal.alpha = 0.5,
  group.legend = NULL, group.title = NULL, group.names = NULL,
  group.side = 3, group.adj = 0.02, group.padj = 2, group.at = NA,
  fit.legend.col = NULL, fit.legend.side = 3, fit.legend.adj = 0.02,
  fit.legend.padj = 2, fit.legend.at = NA, labs.col = NULL,
  na.rm = TRUE, theme = getOption("rt.theme", "lightgrid"),
  palette = getOption("rt.palette", "rtCol1"), zero.lines = NULL,
  zero.col = NULL, zero.alpha = 1, zero.lty = 1, zero.lwd = 1.5,
  order.on.x = NULL, alpha.off = FALSE, autolabel = letters,
  new = FALSE, set.par = TRUE, par.reset = TRUE,
  return.lims = FALSE, pdf.width = 6, pdf.height = 6,
  verbose = FALSE, filename = NULL, ...)

Arguments

x

Numeric vector or list of vectors for x-axis. If data is provided, name of variable, unquoted.

y

Numeric vector of list of vectors for y-axis If data is provided, name of variable, unquoted.

fit

String: rtemis model to calculate y ~ x fit. Options: see modSelect Can also be Logical, which will give a GAM fit if TRUE. If you specify "NLA", the activation function should be passed as a string.

formula

Formula: Provide a formula to be solved using s.NLS. If provided, fit is forced to 'nls'. e.g. y ~ b * m ^ x for a power curve. Note: nls is prone to errors and warnings, but is powerful. Use single letters for parameter names, no numbers.

se.fit

Logical: If TRUE, draw the standard error of the fit

error.x

Vector, float: Error in x (e.g. standard deviation) will be plotted as bars around point

error.y

Vector, float: Error in y (e.g. standard deviation) will be plotted as bars around point

cluster

String: Clusterer name. Will cluster data.frame(x, y) and pass result to group. Run clustSelect for options

cluster.params

List: Names list of parameters to pass to the cluster function

data

(Optional) data frame, where x and y are defined

type

String: "p" for points, "l" for lines, "s" for steps. Default = "p". If x and/or y contains multiple vectors, type can be a vector, e.g. c("p", "l", "l") will give a set of points and two sets of lines. Otherwise, type is recycled to length of x

group

Vector: will be converted to factor. If data is provided, name of variable, unquoted.

xlab

String: x-axis label

ylab

String: y-axis label

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

cex

Float: Character expansion factor (See ?par)

xlim

Float vector, length 2: x-axis limits

ylim

Float vector, length 2: y-axis limits

rsq

Logical: If TRUE, add legend with R-squared (if fit is not NULL)

rsq.pval

Logical: If TRUE, add legend with R-squared and its p-value (if fit is not NULL)

axes

Logical: Should the axes be drawn? Defaults to TRUE

axes.equal

Logical: Should axes be equal? Defaults to FALSE

axes.col

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

pty

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

box

Logical: Should a box be drawn around the plot? Defaults to TRUE for themes "box" and "darkbox"

bty

Character: "o", "l", "7", "c", "u", or "]" result in a box resembling each character. (See ?par)

box.col

Box color

box.alpha

Alpha for box.col

box.lty

Box line type

grid

Logical: Should grid be drawn?

grid.nx

Integer: N of grid lines on the x axis. Use with caution, probably along with xaxs = "i"

grid.ny

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

grid.col

Grid color

grid.alpha

Alpha for grid.col

grid.lty

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

grid.lwd

Grid line width

bg

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

annotation

String: Add annotation at the bottom right of the plot

annotation.col

Color for annotation

tck

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

x.axis.padj

Adjustment for the x axis tick labels position

xlab.line

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

y.axis.padj

Similar to x.axis.padj for the y axis

ylab.line

Similar to xlab.line for the y axis

xlab.adj

adj for xlab (See ?par)

ylab.adj

adj for ylab (See ?par)

mar

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

fit.lwd

Fit line width

se.lty

How to draw the se.fit "poly" draws a polygon around the fit line, otherwise an integer defines the lty (line type) for lines to be drawn

se.col

Color for se.fit

se.alpha

Alpha for se.fit

se.times

Draw polygon or lines at +/- se.times * standard error of fit. Defaults to 2 (1.96 * standard error corresponds to 95% confidence interval)

se.border

Define border of polygon for se.fit. See border in graphics::polygon

se.density

Density of shading line of polygon for se.fit. See density in graphics::polygon

group.legend

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

group.title

String: Group title, shown above group names. e.g. if group names are c("San Francisco", "Philadelphia"), group.title can be "Place of residence"

group.names

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

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

zero.lines

Logical: If TRUE, draw lines at x = 0 and y = 0

zero.col

Color for zero.lines

zero.alpha

Color alpha for zero.lines

zero.lty

Zero line line type

zero.lwd

Zero line width

new

Logical: If TRUE, add plot to existing plot. See par("new")

...

Additional arguments to be passed to learner function

bot.lwd

Box line width

Details

This is relatively old code and may need a little cleaning up