-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
fixed transparency bug #10487
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
fixed transparency bug #10487
Conversation
good catch! Do you happen to have a snippet of code that could be used as a small test? |
Snippet of code to reproduce fixed results (bugged on live)from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
import matplotlib.pyplot as plt
fig = plt.figure()
ax = Axes3D(fig)
x = [0, 1, 1, 0]
y = [0, 0, 1, 1]
z = [0, 1, 0, 1]
verts = [list(zip(x, y, z))]
alpha=0.5
fc = "C0"
pc = Poly3DCollection(verts, alpha = alpha, facecolors=fc, linewidths=1)
ax.add_collection3d(pc)
plt.show() |
I am not sure that is this the right fix as if you apply alpha multiple times they will stack (ex setting the alpha to 0.5 twice will effectively be 0.25). The same fix should probably be applied to edge colors as well. |
Hmm I'll look into that soon, and yeah this seems applicable to edgecolors as well. I just kept it at facecolors for simplicity since I'm a first-time contributer. |
Alpha stacking doesn't seem to be an issue from what I see. I've tested this by applying alpha (setting alpha to 0.5) 6 times (effectively reducing down to 0.01 if stacking occurs), but it remained 0.5, demonstrating that stacking doesn't happen. Let me know if I'm missing something (I'm uploading this response in a bit of a rush!). Code for reproduction:from mpl_toolkits.mplot3d import Axes3D fig = plt.figure() alpha=0.5 pc = Poly3DCollection(verts, alpha = alpha, facecolors=fc, linewidths=1) |
Thanks @DanielMatu This could use a test so this doesn't get missed again, if you are up for it: I think in |
Sounds good. I'll get on that asap. |
What's that travis error that prevents this from passing the tests? It doesn't seem to be part of this PR? |
forced a rebuild |
Would |
+1 for also applying this to edgecolors, as otherwise, this PR won't fully fix the parent issue. |
Travis CI fails for Mac OS with |
Looking at the original issue, there were a few different ways to get the right result and a few ways to get the wrong result. It might make sense to test a few different ways to make sure that this works right. |
ping @DanielMatu Any interest in still working on this? |
Sorry I don't think I'll be working on it anymore. All the best.
…________________________________
From: Thomas A Caswell <notifications@github.com>
Sent: Monday, February 4, 2019 3:56:39 PM
To: matplotlib/matplotlib
Cc: Daniel Matu; Mention
Subject: Re: [matplotlib/matplotlib] fixed transparency bug (#10487)
ping @DanielMatu<https://github.com/DanielMatu> Any interest in still working on this?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#10487 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AVN3uSPAoRvXMJw9774hIgii2Sm-TR80ks5vKJ6HgaJpZM4SHz9R>.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a fix with at least one test. So it’s clearly an improvement and I would merge as is (after a rebase). @WeatherGod do you agree or do you insist on more tests?
Ummm, my apologies, somehow I broke this by force pushing.... |
in Poly3DCollection's set_alpha method, facecolor was getting updated when facecolors3d should have been updated instead.
fixes #10237
PR Summary
PR Checklist