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

Add KDE stat #3111

Merged
merged 6 commits into from
Oct 28, 2022
Merged

Add KDE stat #3111

merged 6 commits into from
Oct 28, 2022

Conversation

mwaskom
Copy link
Owner

@mwaskom mwaskom commented Oct 24, 2022

Largely based on the existing kdeplot API, although currently only supporting univariate KDE estimation (unlike in the functional interface, there will be separate objects for univariate / bivariate distribution transforms).

so.Plot(penguins, "flipper_length_mm").add(so.Area(), so.KDE())

One new trick is that with gridsize=None, it will evaluate the KDE at the original datapoints:

so.Plot(tips, "total_bill").add(so.Dots(), so.KDE(gridsize=None))

This will probably be more useful with a solution for #3053 so that you could have, e.g., a strip plot with color determined by density.

@codecov
Copy link

codecov bot commented Oct 24, 2022

Codecov Report

Merging #3111 (13b1f55) into master (bf46954) will increase coverage by 0.01%.
The diff coverage is 100.00%.

❗ Current head 13b1f55 differs from pull request most recent head 21b2cee. Consider uploading reports for the commit 21b2cee to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3111      +/-   ##
==========================================
+ Coverage   98.39%   98.41%   +0.01%     
==========================================
  Files          74       76       +2     
  Lines       23810    24049     +239     
==========================================
+ Hits        23429    23668     +239     
  Misses        381      381              
Impacted Files Coverage Δ
seaborn/_stats/base.py 96.15% <100.00%> (+2.03%) ⬆️
seaborn/_stats/counting.py 100.00% <100.00%> (ø)
seaborn/_stats/density.py 100.00% <100.00%> (ø)
seaborn/objects.py 100.00% <100.00%> (ø)
tests/_stats/test_counting.py 100.00% <100.00%> (ø)
tests/_stats/test_density.py 100.00% <100.00%> (ø)

@mwaskom mwaskom merged commit 852ffaf into master Oct 28, 2022
@mwaskom mwaskom deleted the stat/kde branch October 28, 2022 22:50
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.

1 participant