Learn R Programming

DataVisualizations (version 1.4.0)

PDEstrip: 1D Density Strip based on Pareto Density Estimation (PDE)

Description

This function renders a single variable's probability density as a horizontal "heat strip", where color encodes local density values. Low-density regions are shown in blue/green, medium-density regions in yellow, and high-density regions in orange/red. It provides a compact alternative to violin or box plots for visualizing the distribution of a single variable.

Usage

PDEstrip(Feature, palette = c("blue","green","yellow","orange","red"))

Value

A ggplot object showing a 1D density strip for the given feature.

Arguments

Feature

Numeric vector. Finite values are used for Pareto Density Estimation (PDE). Non-finite values are ignored.

palette

Character vector of colors defining the low-to-high density gradient, passed to ggplot2::scale_fill_gradientn(). Default is a five-color palette ranging from blue (low density) to red (high density).

Author

Michael Thrun

Details

Density is estimated via Pareto Density Estimation (PDE), a robust and adaptive approach to probability density estimation [Ultsch, 2005]. The returned density values are min-max normalized to [0,1] and mapped to the user-specified color gradient. The strip is drawn with geom_tile() at a fixed y=1, so that each feature is visualized as a single horizontal band. The feature name is automatically captured from the input expression and used as the x-axis label.

References

Ultsch, A.: Pareto Density Estimation: A Density Estimation for Knowledge Discovery, Baier D., Wernecke K.D. (Eds), In Innovations in Classification, Data Science, and Information Systems - Proceedings 27th Annual Conference of the German Classification Society (GfKL) 2003, Berlin, Heidelberg, Springer, pp, 91-100, 2005.

Examples

Run this code
set.seed(1)
x <- c(rnorm(800, 0, 1), rnorm(200, 3, 0.7))
PDEstrip(x)

# Alternative palette
PDEstrip(x, palette = c("navy","skyblue","yellow","orange","darkred"))

Run the code above in your browser using DataLab