Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boxplot with weights #238

Open
jo-fleck opened this issue Jun 6, 2019 · 5 comments
Open

boxplot with weights #238

jo-fleck opened this issue Jun 6, 2019 · 5 comments

Comments

@jo-fleck
Copy link

jo-fleck commented Jun 6, 2019

I have household income data in each US state with household weights so that the income distribution is representative at the state level.

Is there a way to use weights with boxplot?

(I cannot multiply each income with the household weight before plotting because this would affect the value of the max and min.)

Thanks for hints and suggestions!

@mkborregaard
Copy link
Member

It should be easy to add - see #232

@jo-fleck
Copy link
Author

jo-fleck commented Jun 6, 2019

Is this already implemented?

I just updated StatsPlots and tried

@df df boxplot(:var1, :var2, weights(:varweights))

No effect (also no error).

@mkborregaard
Copy link
Member

No it's not implemented yet, but take a look at the implementation in the PR.
The syntax, when it works, would be @df df boxplot(:var1, :var2, weights = :varweights), as we're using the Plots convention of using a keyword, rather than the StatsBase convention of dispatching on the weight vector.

@jo-fleck
Copy link
Author

jo-fleck commented Jun 7, 2019

Ah got it now. I'll have a look.

@mkborregaard I'll try to modify the boxplot code and submit a PR. Can I contact you if I have questions? (I haven't contributed to StatsPlots yet.)

@mkborregaard
Copy link
Member

Yes for sure, the easiest thing is to tag me here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants