plot_lorenz | R Documentation |
This functions plots empirical Lorenz curves for one or several vectors.
plot_lorenz( dat, pal_curves = "npg", title = ifelse(is.numeric(dat), "Lorenz Curve", "Lorenz Curves"), leg.txt = NULL, legend = "topleft", hover = FALSE )
dat |
Numeric vector, or several such vectors organized into a list, optionally named. May also be a data frame of such vectors, however in that case each must be of equal length. Data may include negative values, but if so a warning will be issued to proceed with caution. |
pal_curves |
String specifying the color palette to use when plotting
multiple vectors. Options include |
title |
Optional plot title. |
leg.txt |
Optional legend title. |
legend |
Legend position. Must be one of |
hover |
Show vector name by hovering mouse over Lorenz curve? If |
The Lorenz curve of a distribution plots its cumulative proportion of observations against its cumulative proportion of values. The extent to which the curve sags below the straight diagonal line indicates the variable's degree of inequality. This is measured by the Gini coefficient, which represents the ratio of the area between the line of perfect equality and the distribution's Lorenz curve to the total area under the diagonal line. The statistic has range [0, 1] for non-negative data, with higher coefficients corresponding to more unequal distributions.
Lorenz curves are common in economics, where Gini coefficients are often used to measure the inequality of national income distributions. They also have several omic applications, e.g. to visualize the degree of biodiversity in a microbiome, or the spread of RNA-sequencing counts across libraries.
x <- runif(100) plot_lorenz(x) X <- list("Uniform" = runif(100), "Poisson" = rpois(200, lambda = 5)) plot_lorenz(X)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.