Function to create a scatter plot of two variables.

plot_scatter(
  x,
  y = NULL,
  columns = NULL,
  labels = c("X", "Y"),
  xlim = NULL,
  ylim = NULL,
  new = TRUE,
  w = 5,
  h = 5,
  cex = c(1, 1, 1),
  line = c(1, -1, -1),
  digits = c(2, 2),
  guidelines = TRUE
)

Arguments

x

Either a data frame or a numeric vector.

y

A numeric vector.

columns

A character string of two elements, the columns to use if x is a data frame.

labels

A character string of two elements, the x and y-axis labels, respectively.

xlim

A numeric vector of two values, the lower and upper limit for the x-axis (in standard deviation units).

ylim

A numeric vector of two values, the lower and upper limit for the y-axis (in standard deviation units).

new

A logical value; if TRUE a new plotting window is generated.

w

A numeric value, the width of the new plotting window.

h

A numeric value, the height of the new plotting window.

cex

A numeric vector of three values, the size of the text for the labels, results, and axis values, respectively.

line

A numeric vector of three values, the line position for the labels, results, and axis values, respectively.

digits

A integer vector of two values, the number of digits to round to for the x and y-axis values, respectively.

Value

A scatter plot.

Examples

# Example data
data("iris")
plot_scatter(
  iris, columns = c( 'Petal.Length', 'Sepal.Length' ),
  new = F, labels = c( 'Petal length', 'Sepal length' )
)