View source: R/scatterPlotMatrix.R
scatterPlotMatrix | R Documentation |
htmlwidget
for d3.js
scatter plot matrixhtmlwidget
for d3.js
scatter plot matrix
scatterPlotMatrix(
data,
categorical = NULL,
inputColumns = NULL,
cutoffs = NULL,
keptColumns = NULL,
zAxisDim = NULL,
distribType = 2,
regressionType = 0,
corrPlotType = "Circles",
corrPlotCS = NULL,
rotateTitle = FALSE,
columnLabels = NULL,
continuousCS = "Viridis",
categoricalCS = "Category10",
mouseMode = "tooltip",
eventInputId = NULL,
controlWidgets = FALSE,
cssRules = NULL,
plotProperties = NULL,
slidersPosition = NULL,
width = NULL,
height = NULL,
elementId = NULL
)
data |
|
categorical |
List of list (one for each data column) containing the name of available categories,
or |
inputColumns |
List of boolean (one for each data column),
|
cutoffs |
List of |
keptColumns |
List of boolean (one for each data column), |
zAxisDim |
Name of the column represented by z axis
(used to determine the color to attribute to a point);
|
distribType |
Binary code indicating the type of distribution plot (bit 1: density plot, bit 2: histogram). |
regressionType |
Binary code indicating the type of regression plot (bit 1: linear, bit 2: loess). |
corrPlotType |
String indicating the type of correlation plots to use. Supported values:
|
corrPlotCS |
Name of the color Scale to use for correlation plot
when plot type is |
rotateTitle |
|
columnLabels |
List of string (one for each data column) to display
in place of column name found in data,
or |
continuousCS |
Name of the color Scale to use for continuous data;
supported names: |
categoricalCS |
Name of the color Scale to use for categorical data;
supported names: |
mouseMode |
Type of mouse interaction. Three types are available: |
eventInputId |
When plot event occurred, reactive input to write to;
|
controlWidgets |
Tells if some widgets must be available to control plot;
|
cssRules |
CSS rules to add. Must be a named list of the form list(selector = declarations), where selector is a valid CSS selector and declarations is a string or vector of declarations. |
plotProperties |
Adjust some properties which can not be set through CSS
(mainly size, color and opacity of points).
Default value is list( noCatColor = "#43665e", watermarkColor = "#ddd", point = list( alpha = 0.5, radius = 2 ), regression = list( strokeWidth = 4 ) ) |
slidersPosition |
Set initial position of sliders, specifying which columns intervals are visible.
Default value is list( dimCount = 8, xStartingDimIndex = 1, yStartingDimIndex = 1 ) |
width |
Integer in pixels defining the width of the widget. |
height |
Integer in pixels defining the height of the widget. |
elementId |
Unique |
if(interactive()) {
library(scatterPlotMatrix)
scatterPlotMatrix(iris, zAxisDim = "Species")
# Each point has a color depending of its 'Species' value
categorical <-
list(cyl = c(4, 6, 8), vs = c(0, 1), am = c(0, 1), gear = 3:5, carb = 1:8)
scatterPlotMatrix(mtcars, categorical = categorical, zAxisDim = "cyl")
# 'cyl' and four last columns have a box representation for categories
# (use top slider to see the last three columns)
scatterPlotMatrix(iris, zAxisDim = "Species", distribType = 1)
# Distribution plots are of type 'density plot' (instead of histogram)
scatterPlotMatrix(iris, zAxisDim = "Species", regressionType = 1)
# Add linear regression plots
columnLabels <- gsub("\\.", "<br>", colnames(iris))
scatterPlotMatrix(iris, zAxisDim = "Species", columnLabels = columnLabels)
# Given names are displayed in place of dataset column names;
# <br> is used to insert line breaks
scatterPlotMatrix(iris, cssRules = list(
".jitterZone" = "fill: pink",
".tick text" = c("fill: red", "font-size: 1.8em")
))
# Background of plot is pink and text of axes ticks is red and greater
scatterPlotMatrix(iris, plotProperties = list(
noCatColor = "DarkCyan",
point = list(
alpha = 0.3,
radius = 4
)
))
# Points of plots are different:
# two times greater, with opacity reduced from 0.5 to 0.3, and a `DarkCyan` color
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.