Skip to contents

Methods for constructing blurs, as used in the blur argument to geom_blur_dots() or stat_mcse_dots().

Supports automatic partial function application.

Usage

blur_gaussian(x, r, sd)

blur_interval(x, r, sd, .width = 0.95)

Arguments

x

numeric vector of positive distances from the center of the dot (assumed to be 0) to evaluate blur function at.

r

radius of the dot that is being blurred.

sd

standard deviation of the dot that is being blurred.

.width

for blur_interval(), a probability giving the width of the interval.

Value

A vector of length x giving the opacity of the radial gradient representing the dot at each x value.

Details

These functions are passed x, r, and sd when geom_blur_dots() draws in order to create a radial gradient representing each dot in the dotplot. They return values between 0 and 1 giving the opacity of the dot at each value of x.

blur_gaussian() creates a dot with radius r that has a Gaussian blur with standard deviation sd applied to it. It does this by calculating \(\alpha(x; r, \sigma)\), the opacity at distance \(x\) from the center of a dot with radius \(r\) that has had a Gaussian blur with standard deviation \(\sigma\) = sd applied to it:

$$ \alpha(x; r, \sigma) = \Phi \left(\frac{x + r}{\sigma} \right) - \Phi \left(\frac{x - r}{\sigma} \right) $$

blur_interval() creates an interval-type representation around the dot at 50% opacity, where the interval is a Gaussian quantile interval with mass equal to .width and standard deviation sd.

See also

geom_blur_dots() and stat_mcse_dots() for geometries making use of blurs.

Examples

# see examples in geom_blur_dots()