Introduction to ‘scatterPlotMatrix’


Basic usage (dataset uses factor type)


‘Species’ column is of factor type and has box representation for its categories.

slidersPosition argument

scatterPlotMatrix(iris, slidersPosition = list(
  dimCount = 3, # Number of columns to draw
  xStartingDimIndex = 2, # Index of first drawn column horizontally
  yStartingDimIndex = 2 # Index of first drawn column vertically

Set initial position of sliders, specifying which columns intervals are visible. Here, visible columns starts at second column in x direction, second column in y direction, and three columns are represented.

zAxisDim argument (referenced column is categorical)

scatterPlotMatrix(iris, zAxisDim = "Species")

Each point has a color depending of its ‘Species’ value.

categoricalCS argument

scatterPlotMatrix(iris, zAxisDim = "Species", categoricalCS = "Set1")

Colors used for categories are not the same as previously (supported values: Category10, Accent, Dark2, Paired, Set1).

zAxisDim argument (referenced column is continuous)

scatterPlotMatrix(iris, zAxisDim = "Sepal.Length")

Each point has a color depending of its ‘Sepal.Length’ value.

continuousCS argument

scatterPlotMatrix(iris, zAxisDim = "Sepal.Length", continuousCS = "YlOrRd")

Colors used for points are not the same as previously (supported values: Blues, RdBu, YlGnBu, YlOrRd, Reds).

corrPlotType argument

Supported values: Empty, Circles, Text, AbsText

scatterPlotMatrix(iris, corrPlotType = "Text")

Correlation plots use simple texts instead of circle tree maps as previously; Value of correlations is used to attribute the color, using a color scale with a domain [-1; 1] and the palette ‘RdBu’.

scatterPlotMatrix(iris, corrPlotType = "AbsText")

Absolute value of correlations is used to attribute the color, using a color scale with a domain [0; 1] and palette ‘Blues’.

Basic usage (dataset doesn’t use factor type)


Several columns are of numerical type but should be of factor type (for example ‘cyl’).

categorical argument

categorical <- list(NULL, c(4, 6, 8), NULL, NULL, NULL, NULL, NULL, c(0, 1), c(0, 1), 3:5, 1:8)
scatterPlotMatrix(mtcars, categorical = categorical, zAxisDim = "cyl")

‘cyl’ and four last columns have a box representation for its categories (use top slider to see the last three columns).

distribType argument

scatterPlotMatrix(iris, zAxisDim = "Species", distribType = 1)

Distribution plots are of type ‘density plot’ (instead of histogram).

regressionType argument

scatterPlotMatrix(iris, zAxisDim = "Species", regressionType = 1)

Add linear regression plots.

cutoffs argument

cutoffs <- list(
    xDim = "Sepal.Length",
    yDim = "Species",
    xyCutoffs = list(
      list(c(4, 8), c(-0.1, 0.1)),
      list(c(4, 8), c(1.9, 2.1)))
scatterPlotMatrix(iris, zAxisDim = "Species", cutoffs = cutoffs)

Traces which are not kept by cutoffs are greyed; only kept traces are used for histograms.

rotateTitle argument

scatterPlotMatrix(iris, zAxisDim = "Species", rotateTitle = TRUE)

Column names are rotated (can be useful for long column names).

columnLabels argument

columnLabels <- gsub("\\.", "<br>", colnames(iris))
scatterPlotMatrix(iris, zAxisDim = "Species", columnLabels = columnLabels)

Given names are displayed in place of column names found in dataset; <br> is used to insert line breaks.

cssRules argument

scatterPlotMatrix(iris, cssRules = list(
    ".jitterZone" = "fill: pink", # Set background of plot to pink
    ".tick text" = c("fill: red", "font-size: 1.8em") # Set text of axes ticks red and greater

Apply CSS to the plot. CSS is a simple way to describe how elements on a web page should be displayed (position, colour, size, etc.). You can learn the basics at W3Schools. You can learn how to examine and edit css at MDN Web Docs for Firexox or Chrome devtools for Chrome.

plotProperties argument

scatterPlotMatrix(iris, plotProperties = list(
  noCatColor = "DarkCyan", # Color used when categories coloring is not applied
  point = list(
    alpha = 0.3, # Opacity value used for points
    radius = 4 # Radius used to draw points as circles

Adjust some properties which can not be set through CSS (mainly size, color and opacity of points). Here, points of plot are customised: two times greater, with opacity reduced from 0.5 to 0.3, and a ‘DarkCyan’ color.

controlWidgets argument

scatterPlotMatrix(iris, controlWidgets = TRUE)

Some widgets are available to control the plot.