parallelPlot: htmlwidget for d3.js parallel coordinate plot

View source: R/parallelPlot.R

parallelPlotR Documentation

htmlwidget for d3.js parallel coordinate plot

Description

htmlwidget for d3.js parallel coordinate plot

Usage

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
)

Arguments

data

data.frame with data to use in the chart.

categorical

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.

categoriesRep

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).

arrangeMethod

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.

inputColumns

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.

keptColumns

List of boolean (one for each data column), FALSE if column has to be ignored; NULL is allowed, meaning all columns are available.

histoVisibility

List of boolean (one for each data column), TRUE if an histogram must be displayed; NULL is allowed, meaning no histogram must be displayed.

invertedAxes

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.

cutoffs

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.

refRowIndex

Index of the sample row which has to appear horizontal; NULL is allowed, meaning there is no row to use as reference.

refColumnDim

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.

rotateTitle

TRUE if column title must be rotated.

columnLabels

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.

continuousCS

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.

categoricalCS

Name of the color Scale to use for categorical data; supported names: Category10, Accent, Dark2, Paired, Set1; default value is Category10.

eventInputId

When plot event occurred, reactive input to write to; NULL is allowed, default value is 'plotEvent'.

editionMode

Supported edition modes: EditionOff, EditionOnDrag, EditionOnDragEnd; default value is EditionOff .

controlWidgets

Tells if some widgets must be available to control plot; NULL is allowed, meaning that '!HTMLWidgets.shinyMode' is to use; default value is FALSE.

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.

sliderPosition

Set initial position of slider, specifying which columns interval is visible. Default value is NULL which is equivalent to: list( dimCount = 8, startingDimIndex = 1 )

width

Integer in pixels defining the width of the widget.

height

Integer in pixels defining the height of the widget.

elementId

Unique CSS selector id for the widget.

Value

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.

Examples

 if(interactive()) {
   library(parallelPlot)

   categorical <- list(NULL, c(4, 6, 8), NULL, NULL, NULL, NULL, NULL, c(0, 1), c(0, 1), 3:5, 1:8)
   parallelPlot(mtcars, categorical = categorical, refColumnDim = "cyl")
   # 'cyl' and four last columns have a box representation for its categories

   histoVisibility <- rep(TRUE, ncol(iris))
   parallelPlot(iris, histoVisibility = histoVisibility)
   # An histogram is displayed for each column

   histoVisibility <- rep(TRUE, ncol(iris))
   cutoffs <- list(list(c(6, 7)), NULL, NULL, NULL, c("virginica", "setosa"))
   parallelPlot(iris, histoVisibility = histoVisibility, cutoffs = cutoffs)
   # Cut lines are shaded; an histogram 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("\\.", "<br>", colnames(iris))
   parallelPlot(iris, refColumnDim = "Species", columnLabels = columnLabels)
   # Given names are displayed in place of dataset column names; <br> is used to insert line breaks

   parallelPlot(iris, cssRules = list(
       "svg" = "background: white",
       ".tick text" = c("fill: red", "font-size: 1.8em")
   ))
   # Background of plot is white and text of axes ticks is red and greater
 }


parallelPlot documentation built on April 19, 2023, 1:07 a.m.