mplot3_xym: Scatter plot with marginal density and/or histogram

View source: R/mplot3_xym.R

mplot3_xymR Documentation

Scatter plot with marginal density and/or histogram

Description

Draw a scatter plot with fit line and marginal density and/or histogram

Usage

mplot3_xym(
  x,
  y,
  margin = c("histogram", "density", "both"),
  fit = "gam",
  se.fit = TRUE,
  xlim = NULL,
  ylim = NULL,
  col = "#18A3AC",
  density.alpha = 0.66,
  hist.breaks = 30,
  hist.alpha = 0.66,
  hist.space = 0.05,
  hist.lwd = 3,
  lwd = 4,
  main = NULL,
  main.adj = 0,
  axes.density = FALSE,
  pty = "m",
  mar = c(3, 3, 0, 0),
  margin.mar = 0.2,
  xaxs = "r",
  yaxs = "r",
  theme = rtTheme,
  par.reset = TRUE,
  widths = NULL,
  heights = NULL,
  filename = NULL,
  pdf.width = 7,
  pdf.height = 7,
  ...
)

Arguments

x

Numeric vector: x-axis data

y

Numeric vector: y-axis data

margin

Character: "density", "histogram", or "both". Type of marginal plots to draw.

fit

Character: Algorithm to use to draw y ~ x.

se.fit

Logical: If TRUE: plot +/- 2 * Standard Error of fit

xlim

Float vector, length 2: x-axis limits

ylim

Float vector, length 2: y-axis limits

col

Color for marginal plots

density.alpha

Numeric: Alpha for density plots

hist.breaks

Integer: Number of histogram breaks

hist.alpha

Numeric: Alpha for barplots

hist.space

Numeric: Space between bars in barplots

hist.lwd

Numeric: Line width for barplots

lwd

Numeric: Line width

main

Character: Main title

main.adj

Numeric: Main title adjustment

axes.density

Logical: If TRUE, plot margin plot axes for density (debugging only)

pty

Character: "s" gives a square plot; "m" gives a plot that fills graphics device size. Default = "m" (See par("pty"))

mar

Float, vector, length 4: Margins; see par("mar")

margin.mar

Numeric: Margin for marginal plots

xaxs

Character: "r": Extend plot x-axis limits by 4% on either end; "i": Use exact x-axis limits.

yaxs

Character: as xaxs for the y-axis.

theme

Character: Run themes() for available themes

par.reset

Logical: Resest par to original settings

filename

Character: Path to file to save plot. Default = NULL

pdf.width

Float: Width in inches for pdf output (if filename is set).

pdf.height

Float: Height in inches for pdf output.

...

Additional arguments to passed to mplot3_xy

Details

To make wide plot, change widths: e.g. widths = c(7, 1)

Author(s)

E.D. Gennatas

Examples

## Not run: 
x <- rnorm(500)
y <- x^3 + 12 + rnorm(500)
mplot3_xym(x, y)

## End(Not run)

egenn/rtemis documentation built on Oct. 28, 2024, 6:30 a.m.