peel: Peel off low density regions of the data.

Description Usage Arguments Details Examples

View source: R/peel.r

Description

Keeps specified proportion of data by removing the lowest density regions, either anywhere on the plot, or for 2d, just around the edges.

Usage

1
peel(x, keep = 0.99, central = NULL)

Arguments

x

condensed summary

keep

(approximate) proportion of data to keep. If 1, will remove all cells with counts. All missing values will be preserved.

central

if TRUE peels off regions of lowest density only from the outside of the data. In 2d this works by progressively peeling off convex hull of the data: the current algorithm is quite slow. If FALSE, just removes the lowest density regions wherever they are found. Regions with 0 density are removed regardless of location. Defaults to TRUE if there are two or fewer grouping variables is less.

Details

This is useful for visualisation, as an easy way of focussing on the regions where the majority of the data lies.

Examples

1
2
3
4
5
6
7
8
x <- rt(1e5, df = 2)
y <- rt(1e5, df = 2)
xysum <- condense(bin(x, 1 / 10), bin(y, 1 / 10))
plot(xysum$x, xysum$y)

plot(peel(xysum, 0.95, central = TRUE)[1:2])
plot(peel(xysum, 0.90, central = TRUE)[1:2])
plot(peel(xysum, 0.50, central = TRUE)[1:2])

hadley/bigvis documentation built on May 17, 2019, 9:45 a.m.