Skip to content

Conversation

mwaskom
Copy link
Owner

@mwaskom mwaskom commented Dec 6, 2023

Follow-on to #3580

This adds weights as an option in lineplot, barplot, pointplot, along with the corresponding figure-level functions.

Note that we are going to have to live with the unfortunate contrast between weights= in the function interface and weight= in the object interface. That maintains local consistency (the distribution plot functions already use weights, while the objects interface has a strong singular parameter name convention) at the cost of global consistency. Given that the parameter naming scheme already differs between the two interfaces, I suppose that I can live with it.

As in objects.Est, the use of weights currently limits the statistical options to estimator="mean", errorbar="ci". We'd need to add support for other estimators/errorbars on a case-by-case basis. Note that we shouldn't need to make changes in the interface functions to do so as all of the input checking logic is handled by the underlying statistical objects.

We may want to add weights to violinplot as well. That would look fairly different so it can go in a separate PR. I haven't investigated how complicated it would be. I think that weighted box/boxenplots are probably out of scope.

Closes #3563

Copy link

codecov bot commented Dec 6, 2023

Codecov Report

Merging #3586 (872c7fc) into master (2bb945c) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3586   +/-   ##
=======================================
  Coverage   98.52%   98.52%           
=======================================
  Files          75       75           
  Lines       24622    24668   +46     
=======================================
+ Hits        24259    24305   +46     
  Misses        363      363           
Files Coverage Δ
seaborn/_statistics.py 99.69% <100.00%> (ø)
seaborn/_stats/aggregation.py 97.61% <100.00%> (ø)
seaborn/categorical.py 98.92% <100.00%> (+<0.01%) ⬆️
seaborn/relational.py 99.64% <100.00%> (+<0.01%) ⬆️
tests/test_categorical.py 99.25% <100.00%> (+<0.01%) ⬆️
tests/test_relational.py 99.34% <100.00%> (+<0.01%) ⬆️
tests/test_statistics.py 100.00% <100.00%> (ø)

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

Successfully merging this pull request may close these issues.

Using weighted mean estimator for bootstrapped confidence intervals in seaborn plots
1 participant