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

x_estimator bars now inherit scatter_kws alpha #2540

Closed
wants to merge 1 commit into from

Conversation

milo-trujillo
Copy link
Contributor

@milo-trujillo milo-trujillo commented Apr 2, 2021

x_estimator error bars were previously always opaque, but now inherit alpha parameter from scatterplot settings (if present), since the error bars replace the scatterplot.

Fixes #2538

x_estimator error bars were previously always opaque, but now inherit alpha settings from scatterplot settings, since the error bars replace the scatterplot
@codecov
Copy link

codecov bot commented Apr 2, 2021

Codecov Report

Merging #2540 (f7f7831) into master (0f538fb) will decrease coverage by 0.01%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2540      +/-   ##
==========================================
- Coverage   97.45%   97.43%   -0.02%     
==========================================
  Files          17       17              
  Lines        6325     6327       +2     
==========================================
+ Hits         6164     6165       +1     
- Misses        161      162       +1     
Impacted Files Coverage Δ
seaborn/regression.py 97.50% <50.00%> (-0.30%) ⬇️

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 0f538fb...f7f7831. Read the comment docs.

@mwaskom
Copy link
Owner

mwaskom commented Apr 3, 2021

👍 on the change; it would be good to cover this line in the tests though. I think adding a simple sub-case to this function should do it.

Also I edited your summary text to use github's (somewhat restricted) vernacular for linking issues such that they auto-close when the PR is merged.

@milo-trujillo
Copy link
Contributor Author

Agreed on testing. What's the correct variable to check to confirm that the error bars have the desired transparency? Would it still be ax.collections[0]._alpha? If so I can add another trivial sub-case that uses alpha and x_estimator.

@mwaskom
Copy link
Owner

mwaskom commented Apr 3, 2021

Hm that test shouldn't be accessing those private attributes ... but also the error bars will be in the ax.lines list.

@mwaskom
Copy link
Owner

mwaskom commented May 11, 2021

@milo-trujillo let me know if you need help putting a test together ... I think the basic idea is something like this:

alpha = .3
ax = sns.regplot(
    data=tips, x="x", y="y",
    x_bins=5, fit_reg=False, scatter_kws=dict(alpha=alpha)
)
for line in ax.lines:
    assert line.get_alpha() == alpha

mwaskom added a commit that referenced this pull request Jun 12, 2022
mwaskom added a commit that referenced this pull request Jun 12, 2022
* x_estimator bars now inherit scatter_kws alpha

x_estimator error bars were previously always opaque, but now inherit alpha settings from scatterplot settings, since the error bars replace the scatterplot

* Inherit errorbar alpha from scatter points in regplot

Closes #2540 by adding a test.

Co-authored-by: Milo Trujillo <[email protected]>
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.

lmplot/regplot can't set alpha of x_estimator
2 participants