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

Enforce keywords for most args and rearrange signatures #2804

Merged
merged 3 commits into from
May 15, 2022

Conversation

mwaskom
Copy link
Owner

@mwaskom mwaskom commented May 14, 2022

Making good on the warning added in v0.11.0, plotting functions now require explicit keywords for most of their arguments.

Additionally, signatures have been arranged to place data first, as the only non-keyword argument. Now all functions have a consistent signature

func(data, *, [x, y,], [hue,], ...)

Aside from consistency, this reorganizatino has a couple advantages:

  • With wide-form data handling, (nearly) all functions will do something when called as func(data)
  • Pandas dataframes can be directly piped into all seaborn functions without writing (func, "data").

On the keyword-only side of the signature, a few functions were further reorganized to group together releated parameters that had been added at different times.

For more context, see the original function that added the warning: #2081

Fixes #2055

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

codecov bot commented May 14, 2022

Codecov Report

Merging #2804 (c63ec16) into master (bb03ae1) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #2804      +/-   ##
==========================================
- Coverage   97.47%   97.45%   -0.03%     
==========================================
  Files          17       17              
  Lines        6451     6399      -52     
==========================================
- Hits         6288     6236      -52     
  Misses        163      163              
Impacted Files Coverage Δ
seaborn/axisgrid.py 96.05% <ø> (-0.03%) ⬇️
seaborn/categorical.py 98.24% <ø> (-0.02%) ⬇️
seaborn/matrix.py 95.81% <ø> (-0.04%) ⬇️
seaborn/regression.py 97.85% <ø> (-0.03%) ⬇️
seaborn/_decorators.py 100.00% <100.00%> (ø)
seaborn/distributions.py 96.38% <100.00%> (-0.02%) ⬇️
seaborn/relational.py 99.69% <100.00%> (-0.01%) ⬇️

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 bb03ae1...c63ec16. Read the comment docs.

@mwaskom mwaskom merged commit 42dc863 into master May 15, 2022
@mwaskom mwaskom deleted the api/keyword_only branch May 15, 2022 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Order of scatterplot semantics does not match other relational plots
1 participant