stackedDenistyPlot: A function to create stacked density plot using ggplot

Description Usage Arguments Value Examples

Description

A function to create stacked density plot using ggplot

Usage

1
2
3
4
5
6
7
stackedDenistyPlot(data, densityColNames, stackFactor, stackColor,
  kernel = c("gaussian", "epanechnikov", "rectangular", "triangular",
  "biweight", "cosine", "optcosine"), bw = "nrd0", adjust = 1,
  reomoveOutliers = FALSE, stackRotation = 0, stackSeperation = "auto",
  x_text_size = 2, strip_text_size = 7, legend_text_size = 0.5,
  legendRow = 1, legend_title = "stackName", legend_title_size = 1,
  legend_key_size = 0.2)

Arguments

data

Data frame containing columns for density calculation.

densityColNames

The column names of those passed to density calculation.

stackFactor

A factor to create the stacks, length equalt to number of rows in data.

stackColor

Default use rainbow colour palette, but can be specified manually.

kernel

kernel applied for density calculation, includes "gaussian", "epanechnikov", "rectangular", "triangular", "biweight", "cosine", "optcosine".

bw

The smoothing bandwidth to be used. The default, "nrd0", has remained the default for historical and compatibility reasons, rather than as a general recommendation, where e.g., "SJ" would rather fit.

adjust

The bandwidth used is actually adjust*bw.

reomoveOutliers

If coerce the outliers to 1.5*IQR level.

stackRotation

How many degrees to rotate the density stacks.

stackSeperation

Adjust the stack height intervels, use "auto" for automatic adjustment; or specify a value form 0 to 1 times the median height of to all density plots.

x_text_size

Adjust the text size on x ticks.

strip_text_size

Adjust the text size on strip.

legend_text_size

Adjust the text size on legend.

legendRow

The number of rows of the legend.

legend_title

The title of the legend.

legend_title_size

The size of the legend title.

legend_key_size

Adjust the size of the legend key.

Value

a ggplot object

Examples

1
2
3
4
data <- iris[ ,1:4]
densityColNames <- colnames(data)
stackFactor <- iris[ ,5]
stackedDenistyPlot(data, densityColNames, stackFactor, strip_text_size = 9, legend_text_size = 0.8, legend_key_size = 0.15)

haoeric/StackedDensityPlot documentation built on May 17, 2019, 2:29 p.m.