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 Norm move class #2827

Merged
merged 2 commits into from
Jun 2, 2022
Merged

Add Norm move class #2827

merged 2 commits into from
Jun 2, 2022

Conversation

mwaskom
Copy link
Owner

@mwaskom mwaskom commented May 31, 2022

A simple Move operation (slightly stretching the functionality beyond "reduce over-plotting") that does a divisive normalization by an arbitrary function.:

so.Plot(penguins, "bill_length_mm").add(so.Bar(), so.Hist(), so.Norm())

Screen Shot 2022-05-31 at 8 31 48 PM

The function and grouping are flexible, and it can be chained with other moves in interesting ways:

(
    so.Plot(tips, x="day", y="total_bill", color="sex")
    .add(so.Bar(), so.Hist(), [so.Norm("sum", by=["x"]), so.Stack()])
)

image

There is also some flexibility to the domain across where the normalizer is computed:

(
    so.Plot(gapminder, "year", "lifeExp", color="continent")
    .add(so.Line(), so.Agg(), so.Norm(where="x == 1977"))
)

image

@mwaskom mwaskom added this to the v0.12.0 milestone May 31, 2022
@codecov
Copy link

codecov bot commented May 31, 2022

Codecov Report

Merging #2827 (90d14ad) into master (fefd940) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #2827   +/-   ##
=======================================
  Coverage   98.04%   98.04%           
=======================================
  Files          68       68           
  Lines       21991    22042   +51     
=======================================
+ Hits        21561    21612   +51     
  Misses        430      430           
Impacted Files Coverage Δ
seaborn/_core/moves.py 100.00% <100.00%> (ø)
seaborn/_core/plot.py 94.58% <100.00%> (+0.04%) ⬆️
seaborn/objects.py 100.00% <100.00%> (ø)
seaborn/tests/_core/test_moves.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fefd940...90d14ad. Read the comment docs.

@mwaskom mwaskom merged commit 1e8e843 into master Jun 2, 2022
@mwaskom mwaskom deleted the nextgen/norm branch June 2, 2022 00:33
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