htmlwidget
for d3.js
parallel coordinate plothtmlwidget
for d3.js
parallel coordinate plot
parallelPlot(
data,
categorical = NULL,
categoriesRep = "EquallySpacedLines",
arrangeMethod = "fromRight",
inputColumns = NULL,
keptColumns = NULL,
histoVisibility = NULL,
invertedAxes = NULL,
cutoffs = NULL,
refRowIndex = NULL,
refColumnDim = NULL,
rotateTitle = FALSE,
columnLabels = NULL,
continuousCS = "Viridis",
categoricalCS = "Category10",
eventInputId = NULL,
editionMode = "EditionOff",
controlWidgets = FALSE,
cssRules = NULL,
sliderPosition = NULL,
width = NULL,
height = NULL,
elementId = NULL
)
An object of class htmlwidget
that will intelligently print itself into HTML
in a variety of contexts including the R console, within R Markdown documents,
and within Shiny output bindings.
data.frame
with data to use in the chart.
List of list (one for each data column) containing the name of available categories,
or NULL
if column corresponds to continuous data;
NULL
is allowed, meaning all columns are continuous.
A named list can also be provided to only indicate which columns are categorical,
associating a column name to available categories.
Within a category column, the height assigned to each category can either be:
equal for each category (EquallySizedBoxes
);
or calculated to reflect the proportion of lines passing
through each category (EquallySpacedLines
).
Within a category box:
the position of lines can be calculated to minimize
crossings on the left of the box (fromLeft
);
the position of lines can be calculated to minimize
crossings on the right (fromRight
, default behavior);
lines can be split in two points to minimize
crossings on the left and on the right (fromBoth
).
To turn this ordering off (for example for performance reasons),
arrangeMethod
can also be set to fromNone
.
List of boolean (one for each data column),
TRUE
for an input column, FALSE
for an output column;
NULL
is allowed, meaning all columns are inputs.
A list of column names can also be provided to only indicate which columns are inputs.
List of boolean (one for each data column), FALSE
if column has to be ignored;
NULL
is allowed, meaning all columns are available.
A list of column names can also be provided
to only indicate which columns are to be kept.
List of boolean (one for each data column), TRUE
if an histogram must be displayed;
NULL
is allowed, meaning no histogram must be displayed.
A list of column names can also be provided
to only indicate which columns must have an histogram displayed.
List of boolean (one for each data column), TRUE
if orientation of axis must be inverted;
NULL
is allowed, meaning no axis must be inverted.
A list of column names can also be provided
to only indicate which columns must have an inverted axis.
List of list (one for each data column) of list (one for each cutoff)
containing two values (min and max values defining the cutoff)
or NULL
if there is no cutoff to apply;
NULL
is allowed, meaning all columns are without cutoff.
A named list can also be provided to only indicate which columns have cutoffs,
associating a column name to its cutoffs.
Index of the sample row which has to appear horizontal;
NULL
is allowed, meaning there is no row to use as reference.
Name of the reference column (used to determine the color to attribute to a row);
NULL
is allowed, meaning there is no coloring to apply.
TRUE
if column title must be rotated.
List of string (one for each data column) to display in place of column name found in data,
or NULL
if there is no alternative name;
NULL
is allowed, meaning all columns are without alternative name;
<br>
can be used to insert line breaks.
Name of the color Scale to use for continuous data;
supported names: Viridis
, Inferno
, Magma
, Plasma
, Warm
, Cool
, Rainbow
,
CubehelixDefault
, Blues
,Greens
, Greys
, Oranges
, Purples
, Reds
, BuGn
,
BuPu
, GnBu
, OrRd
, PuBuGn
,PuBu
, PuRd
, RdBu
, RdPu
, YlGnBu
, YlGn
,
YlOrBr
, YlOrRd
;
default value is Viridis
.
Name of the color Scale to use for categorical data;
supported names: Category10, Accent, Dark2, Paired, Set1;
default value is Category10
.
When plot event occurred, reactive input to write to;
NULL
is allowed, meaning no event is sent.
An event is a list with two named elements 'type' and 'value'.
If type
is equal to cutoffChange
:
value$adjusting
is TRUE
when pointer is moving, changing a cutoff;
value$updatedDim
is the name of last cut column;
value$selectedTraces
gives the indexes of uncut rows;
value$cutoffs
gives the new values for the cutoffs.
If type
is equal to axeOrientationChange
:
value$invertedAxes
has the same form than invertedAxes
argument.
If type
is equal to refColumnDimChange
:
value$refColumnDim
is the new column to use as reference
(see refColumnDim
argument).
If type
is equal to rowClicked
:
value$rowIndex
is the index of the clicked row.
If type
is equal to pointChange
:
value$dim
defines the column of the edited point;
value$rowIndex
defines the row of the edited point;
value$newValue
gives the new value for the edited point.
Supported edition modes: EditionOff
, EditionOnDrag
, EditionOnDragEnd
;
default value is EditionOff
.
Tells if some widgets must be available to control plot;
NULL
is allowed, meaning that !HTMLWidgets.shinyMode
is to use;
default value is FALSE
.
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.
Set initial position of slider, specifying which columns interval is visible.
Default value is NULL
which is equivalent to:
list(
dimCount = 8,
startingDimIndex = 1
)
Integer in pixels defining the width of the widget.
Integer in pixels defining the height of the widget.
Unique CSS
selector id for the widget.
if(interactive()) {
library(parallelPlot)
categorical <-
list(cyl = c(4, 6, 8), vs = c(0, 1), am = c(0, 1), gear = 3:5, carb = 1:8)
parallelPlot(mtcars, categorical = categorical, refColumnDim = "cyl")
# `cyl` and four last columns have a box representation for categories
histoVisibility <- rep(TRUE, ncol(iris))
parallelPlot(iris, histoVisibility = histoVisibility)
# An histogram is displayed for each column
histoVisibility <- names(iris) # Same as `rep(TRUE, ncol(iris))`
cutoffs <- list(Sepal.Length = list(c(6, 7)), Species = c("virginica", "setosa"))
parallelPlot(iris, histoVisibility = histoVisibility, cutoffs = cutoffs)
# Cut lines are shaded;
# an histogram for each column is displayed considering only kept lines
parallelPlot(iris, refRowIndex = 1)
# Axes are shifted vertically in such a way that first trace
# of the dataset looks horizontal
columnLabels <- gsub("\\.", "", colnames(iris))
parallelPlot(iris, refColumnDim = "Species", columnLabels = columnLabels)
# Given names are displayed in place of dataset column names;
# is used to insert line breaks
parallelPlot(iris, cssRules = list(
"svg" = "background: #C2C2C2",
".tick text" = c("fill: red", "font-size: 1.8em")
))
# Background of plot is grey and text of axes ticks is red and greater
}
Run the code above in your browser using DataLab