xyhist {datana}R Documentation

A scatterplot with marginal histograms

Description

The function produces a scatterplot between the 'y'-axis variable and the 'x'-axis variable, but also adding the marginal histograms for both variables.

Usage

xyhist(
  x = x,
  y = y,
  col.x = "blue",
  col.y = "red",
  xlab = NULL,
  ylab = NULL,
  x.lim = NULL,
  y.lim = NULL
)

Arguments

x

A numeric vector representing the X-axis variable

y

A numeric vector representing the Y-axis variable

col.x

(optional) A string specifying the color of the histogram of the X-variable. Default is "blue".

col.y

(optional) A string specifying the color of the histogram of the Y-variable. Default is "red".

xlab

(optional) A string specifying X-axis label. Default is "xvar".

ylab

(optional) A string specifying Y-axis label. Default is "yvar".

x.lim

(optional) A vector of two elements with the limits of the Y-axis. Default is the range of the X-variable.

y.lim

(optional) A vector of two elements with the limits of the Y-axis. Default is the range of the Y-variable.

Details

Both the response variable (Y-axis) and the predictor variable (X-axis) must be numeric.

Value

The function returns the above described graph.

Author(s)

Christian Salas-Eljatib

References

Examples

data(treevolroble)
df <- datana::treevolroble
head(df)
xyhist(x=df$dbh,y=df$toth)
xyhist(x=df$dbh,y=df$toth, xlab="Variable X",  ylab="Variable Y")
xyhist(x=df$dbh,y=df$toth, xlab="Variable X", ylab="Variable Y",
  col.x = "gray",col.y="white")

[Package datana version 1.1.1 Index]