Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Update art3d.py to address strange behavior of depthshading on 3D scatterplots with close points#23085
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Closed
Uh oh!
There was an error while loading.Please reload this page.
Closed
Update art3d.py to address strange behavior of depthshading on 3D scatterplots with close points#23085
Changes fromall commits
Commits
Show all changes
18 commits Select commitHold shift + click to select a range
00d5d05
Update art3d.py
af2e2a2
Update art3d.py
1ed4648
Update art3d.py
ca24aae
Updated art3d.py per feedback
2ef7284
Update art3d.py
c085f47
Update art3d.py
6bb3cd5
Update art3d.py per reviewer feedback
2458402
Update art3d.py per reviewer feedback
bc4b40a
Merge branch 'matplotlib:main' into 22861_bugfix
nhansendev52ad303
Improvements for depth-shading
nhansendev968047b
Added kwargs for depth-shading
nhansendev8657a07
Create depthshading_improvement.rst
nhansendevb32d00b
Update depthshading_improvement.rst
nhansendevea4fff7
Merge branch 'main' into 22861_bugfix
nhansendev25d0e22
Update art3d.py formatting
nhansendevcfc05aa
Update axes3d.py formatting
nhansendevdfb395c
Update depthshading_improvement.rst formatting
nhansendevdc80ea0
Update depthshading_improvement.rst formatting
nhansendevFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
53 changes: 53 additions & 0 deletionsdoc/users/next_whats_new/depthshading_improvement.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
Depth-shading fix and more depth-shading options | ||
-------------------------------------------------------------- | ||
New options have been added which allow users to modify the behavior of | ||
depth-shading while addressing a visual bug. | ||
Previously, a slightly buggy method of estimating the "depth" of plotted | ||
items could lead to sudden and unexpected changes in transparency as the | ||
plot orientation changed. | ||
Now, the behavior has been made smooth and predictable, and the user is | ||
provided with three new options: whether to invert the shading, setting the | ||
lowest acceptable alpha value (highest transparency), and whether to use | ||
the old algorithm. | ||
The default behavior visually matches the old algorithm: items that appear to be | ||
"deeper" into the screen will become increasingly transparent (up to the now | ||
user-defined limit). If the inversion option is used then items will start | ||
at maximum transparency and become gradually opaque with increasing depth. | ||
Note 1: depth-shading applies to Patch3DCollections and Path3DCollections, | ||
including scatter plots. | ||
Note 2: "depthshade=True" must still be used to enable depth-shading | ||
A simple example: | ||
.. plot:: | ||
:include-source: true | ||
:alt: A simple example showing different behavior of depthshading, which can be modified using the provided kwargs. | ||
import matplotlib.pyplot as plt | ||
fig = plt.figure() | ||
ax = fig.add_subplot(projection="3d") | ||
X = [i for i in range(10)] | ||
Y = [i for i in range(10)] | ||
Z = [i for i in range(10)] | ||
S = [(i + 1) * 400 for i in range(10)] | ||
ax.scatter( | ||
xs=X, | ||
ys=Y, | ||
zs=Z, | ||
s=S, | ||
depthshade=True, | ||
depthshade_minalpha=0.1, | ||
depthshade_inverted=True, | ||
depthshade_legacy=True, | ||
) | ||
plt.show() |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.