method_freqpoly_1d | R Documentation |
Function used to specify univariate frequency polygon density estimator
for get_hdr_1d()
and layer functions (e.g. geom_hdr_rug()
).
method_freqpoly_1d(bins = NULL)
bins |
Number of bins. Defaults to normal reference rule (Scott, pg 59). |
For more details on the use and implementation of the method_*_1d()
functions,
see vignette("method", "ggdensity")
.
Scott, David W. Multivariate Density Estimation (2e), Wiley.
df <- data.frame(x = rnorm(1e3)) # Strip chart to visualize 1-d data p <- ggplot(df, aes(x)) + geom_jitter(aes(y = 0), width = 0, height = 2) + scale_y_continuous(name = NULL, breaks = NULL) + coord_cartesian(ylim = c(-3, 3)) p p + geom_hdr_rug(method = method_freqpoly_1d()) # The resolution of the frequency polygon estimator can be set via `bins` p + geom_hdr_rug(method = method_freqpoly_1d(bins = 100)) # Can also be used with `get_hdr_1d()` for numerical summary of HDRs res <- get_hdr_1d(df$x, method = method_freqpoly_1d()) str(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.