8000 Fix scatter alpha by tacaswell · Pull Request #8954 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Fix scatter alpha #8954

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

Merged
merged 2 commits into from
Aug 21, 2017
Merged

Fix scatter alpha #8954

merged 2 commits into from
Aug 21, 2017

Conversation

tacaswell
Copy link
Member

PR Summary

fixes #8953

The issue is that we are re-setting the original (un-alpha-ified) color and then letting the draw re-apply the new alpha. However, if there is color-mapped data the color that gets re-set is the default (apparently). Fix this by flagging the array as updated so that update_colormappable fires and re-set the colors properly.

PR Checklist

  • Has Pytest style unit tests
  • Cde s PEP 8 compliant

@tacaswell tacaswell added this to the 2.2 (next next feature release) milestone Jul 28, 2017
@@ -624,3 +624,14 @@ def test_lslw_bcast():
col.set_linestyles(['-', '-', '-'])
assert_equal(col.get_linestyles(), [(None, None)] * 3)
assert_equal(col.get_linewidths(), [1, 2, 3])


@image_comparison(baseline_images=['scatter_post_alpha'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a test that can just be a "check the colours haven't changed" test instead of an image test?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe 8000 this comment to others. Learn more.

I don't think so as there is some draw-time computation that goes on here with the color mapping.

@@ -711,6 +711,7 @@ def set_alpha(self, alpha):
float(alpha)
except TypeError:
raise TypeError('alpha must be a float or None')
self.update_dict['array'] = True
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add an explanation here? I am still completely confused why this has to be here for setting alphas, but not anywhere else for any of the other colorsetting code.

Could this be the result of the collision of RGBA color specs and a separate alpha parameter?

@efiring efiring merged commit 3b3278e into matplotlib:master Aug 21, 2017
@QuLogic QuLogic modified the milestones: 2.1 (next point release), 2.2 (next next feature release) Aug 21, 2017
@tacaswell tacaswell deleted the fix_scatter_alpha branch August 21, 2017 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: PathCollection.set_alpha causes colormap to be lost
5 participants
0