method_freqpoly {ggdensity} | R Documentation |
Bivariate frequency polygon HDR estimator
Description
Function used to specify bivariate frequency polygon density estimator
for get_hdr()
and layer functions (e.g. geom_hdr()
).
Usage
method_freqpoly(bins = NULL)
Arguments
bins |
Number of bins along each axis. Either a vector of length 2 or a scalar value which is recycled for both dimensions. Defaults to normal reference rule (Scott, pg 87). |
Details
For more details on the use and implementation of the method_*()
functions,
see vignette("method", "ggdensity")
.
References
Scott, David W. Multivariate Density Estimation (2e), Wiley.
Examples
set.seed(1)
df <- data.frame(x = rnorm(1e3), y = rnorm(1e3))
ggplot(df, aes(x, y)) +
geom_hdr(method = method_freqpoly()) +
geom_point(size = 1)
# The resolution of the frequency polygon estimator can be set via `bins`
ggplot(df, aes(x, y)) +
geom_hdr(method = method_freqpoly(bins = c(8, 25))) +
geom_point(size = 1)
# Can also be used with `get_hdr()` for numerical summary of HDRs
res <- get_hdr(df, method = method_freqpoly())
str(res)
[Package ggdensity version 1.0.0 Index]