dViolins: Create violin plots for any variables of choise

View source: R/dViolins.R

dViolinsR Documentation

Create violin plots for any variables of choise

Description

Here, assymetrical violin plots for each cluster vs all other clusters are plotted for variables either retrieved from a depeche analysis or user-defined.

Usage

dViolins(
  clusterVector,
  inDataFrame,
  plotClusters = unique(clusterVector),
  plotElements = "all",
  colorOrder = plotClusters,
  colorScale = "viridis",
  plotDir = "dViolin_result",
  createOutput = TRUE
)

Arguments

clusterVector

Vector with the same length as inDataFrame containing information about the cluster identity of each observation.

inDataFrame

The data used to generate the depecheObject

plotClusters

This vector of numbers define which cluster(s) to plot the violins for. Defaults to all.

plotElements

This provides information on which features to plot. In the typical case, this is the essenceElementList from a depeche run. Other input formats are however accepted: if a vector of column names is provided, then these features will be plotted for all clusters. A custom list of features specific for each cluster is also accepted. A final alternative is to return "all" (default), in which case all markers will be plotted for all clusters.If more than a 100 markers are provided, however, this will return an error.

colorOrder

The order of the cluster colors. Defaults to the order that the unique values in clusterVector occurs.

colorScale

The color scale. Options identical to dColorVector.

plotDir

The name of the created directory.

createOutput

For testing purposes. Defaults to TRUE. If FALSE, no plots are generated.

Value

One graph is created for each cluster, containing a bean per specified variable.

See Also

dDensityPlot, dColorPlot, dColorVector, depeche

Examples

# Load some data
data(testData)

# Run the clustering function. For more rapid example execution,
# a depeche clustering of the data is inluded
# testDataDepeche <- depeche(testData[,2:15])
data(testDataDepeche)

# Create the plots of the variables that contribute to creating cluster 3
dViolins(testDataDepeche$clusterVector,
    inDataFrame = testData,
    plotClusters = 3, plotElements = testDataDepeche$essenceElementList
)

Theorell/DepecheR documentation built on July 27, 2023, 8:13 p.m.