| mf_distr | R Documentation |
This function displays the statistical distribution of a variable with a histogram, a box plot, a strip chart and a density curve on the same plot.
This graphic can be useful to choose an appropriate classification method for choropleth maps.
User-defined class boundaries can also be displayed on the plot.
mf_distr(
x,
nbins,
bw,
breaks,
pal,
alpha = 1,
rev = FALSE,
main = "Distribution",
yaxt = TRUE,
ylab = "Density",
seed = 46
)
x |
a numeric variable |
nbins |
number of bins in the histogram |
bw |
bandwidth of the density curve |
breaks |
a vector of class boundaries. If |
pal |
a color, a set of colors (hex codes) or a palette name.
Palette names can be obtained with hcl.pals. The default color is either
the highlight color if |
alpha |
opacity, in the range [0,1] (0 means transparent and 1 means opaque). Default is set to 1. |
rev |
logical indicating whether the ordering of the colors should be reversed |
main |
plot title |
yaxt |
if FALSE the y axis is not displayed |
ylab |
y axis label |
seed |
seed used to position the points on the strip chart |
The number of bins of the histogram and the bandwidth of the density curve are (invisibly) returned in a list.
(mf_distr(rnorm(1000)))
mf_distr(rbeta(1000, .6, 7))
mf_distr(rbeta(1000, 5, .6))
a <- rbeta(1000, .6, 7)
bks <- mf_get_breaks(a, nbreaks = 5, breaks = "quantile")
mf_distr(a, breaks = bks)
mf_distr(a,
breaks = bks, pal = "Teal", yaxt = FALSE,
main = 'Classification method : "quantile"'
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.