Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Fix depth shading on 3D scatterplots#29287
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
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
d0c8011
f772eeb
d5562e9
9a62494
2d73765
73b3b08
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
3D depth-shading fix | ||
-------------------- | ||
Previously, a slightly buggy method of estimating the visual "depth" of 3D | ||
items could lead to sudden and unexpected changes in transparency as the plot | ||
orientation changed. | ||
Now, the behavior has been made smooth and predictable. A new parameter | ||
``depthshade_minalpha`` has also been added to allow users to set the minimum | ||
scottshambaugh marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
transparency level. Depth-shading is an option for Patch3DCollections and | ||
Path3DCollections, including 3D scatter plots. | ||
The default values for ``depthshade`` and ``depthshade_minalpha`` are now also | ||
scottshambaugh marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
controlled via rcParams, with values of ``True`` and ``0.3`` respectively. | ||
A simple example: | ||
.. plot:: | ||
scottshambaugh marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
:include-source: true | ||
:alt: A 3D scatter plot with depth-shading enabled. | ||
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.3, | ||
) | ||
plt.show() |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.