custom_splom: Custom scatterplot matrix (SPLOM)

View source: R/custom_splom.R

custom_splomR Documentation

Custom scatterplot matrix (SPLOM)

Description

A wrapper function around lattice 'splom' with different upper and lower panels. A scatterplot matrix is a tiled plot where all variables of a data frame are plotted against each other.

Usage

custom_splom(
  df,
  ...,
  aspect = 1,
  between = list(x = 0.5, y = 0.5),
  col_palette = c("steelblue", grey(0.95), "darkorange"),
  pscales = 4,
  strip = NULL,
  groups = NULL,
  main = NULL,
  xlab = NULL,
  ylab = NULL,
  pch = 19,
  col = grey(0.5),
  cex = 0.8
)

Arguments

df

(data.frame) data frame whose columns are plotted against each other

...

other arguments passed to the 'splom' function

aspect

(numeric) aspect ratio between height and width, default = 1.

between

(list) list with two named vectors x and y indicating space between panels

col_palette

(list) list of colors to use for colorRampPalette

pscales

(numeric) controls the number of ticks and tick labels to draw at axes

strip

(list) controlling strip appearance, defaults to NULL.

groups

(character) a grouping variable (untested feature)

main

(character) title of the plot

xlab

(character) label of X axis

ylab

(character) label of y axis

pch

(numeric) the plotting symbol to be used

col

(character) the color to be used

cex

(numeric) character size of the symbol

Examples

library(lattice)
data(mtcars)

# Draw a scatterplot matrix of all variables of a 
# data frame against each other.
custom_splom(mtcars[1:5])

# We can customize the scatterplot
custom_splom(
  mtcars[1:5],
  col_palette = rainbow(4),
  pscales = 10,
  xlab = "data points", ylab = "regression",
  pch = 1, col = 1, cex = 0.6
)


m-jahn/lattice-tools documentation built on Dec. 3, 2023, 11:14 p.m.