Closed CWen001 closed 4 years ago
Hi, yes, you can do this, but we need to add it to the stat_lorenz() help page...
stat_lorenz() can take a parameter called n with the frequency of the observations. For example:
ggplot(data, aes(x=value, n=freq)) +stat_lorenz()
this should work. See pull request: https://github.com/jjchern/gglorenz/pull/1
I will update the documentation soon.
Thank you very much, and the n
parameter works as expected. One more thing, the package has a handy function annotate_ineq
[] to label the Gini value. Is it also possible to improve it by adding a weighting parameter?
We haven't implemented this yet, but you can do this to get the same result:
ggplot(data,aes(x=val,n=freq)) +stat_lorenz() +annotate_ineq(rep.int(data$val,data$freq))
Many thanks for your kind help! closing this issue as all problems solved.
Hello, I'm trying to use this package to plot lorenz with weight considered, but I could find documentation about that. Is there a way to consider weight in plotting?
It is a a common use case to analyze data of the census units, which have both income and population variables. Therefore, it would be nice to plot lorenz curve for income with population as weight. Thank you very much.