mplot3_xym: 'mplot3' Scatter plot with marginal density and/or histogram

View source: R/mplot3_xym.R

mplot3_xymR Documentation

mplot3 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),
  mar.mar = 0.2,
  axes = TRUE,
  xaxs = "r",
  yaxs = "r",
  theme = rtTheme,
  par.reset = TRUE,
  widths = NULL,
  heights = NULL,
  filename = NULL,
  pdf.width = 7,
  pdf.height = 7,
  ...
)

Arguments

x

x-data

y

y-data

margin

What type of marginal plots to draw. Options: "density", "histogram", or "both"

fit

What model to use to draw y ~ x. Options: mode.select()

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

Alpha for density plots

hist.breaks

Integer. Number of histogram breaks

hist.alpha

Alpha for barplots

hist.space

Space between bars in barplots

lwd

Float: Line width

main

Character: Main title

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

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 be passed to mplot3_xy

Details

At the moment, mplot3_xym is the only mplot3 function that does not support

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 May 4, 2024, 7:40 p.m.