Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Handle NaN values inplot_surface zsort#20646

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
tomneep wants to merge4 commits intomatplotlib:masterfromtomneep:surface_zsort_fix
Closed
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletionlib/mpl_toolkits/mplot3d/art3d.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -737,6 +737,18 @@ def set_zsort(self, zsort):
self._sort_zpos = None
self.stale = True

def _zsortval(self, zs):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def_zsortval(self,zs):
def_zsortval(self,zs):
"""Computethevaluetouseforz-sortinggiventheviewerzcoordinatesofanobject`zs`,with
largervaluesdrawnunderneathsmallervalues.
Thisfunctionshouldneverreturn`nan`,andreturns`np.inf`ifnonon-nanvalueiscomputable.
"""

tomneep reacted with thumbs up emoji
"""
Compute the value to use for z-sorting given the viewer z
coordinates of an object `zs`, with larger values drawn underneath
smaller values.

This function should never return `nan`, and returns `np.inf` if no
non-nan value is computable.
"""
nans = np.isnan(zs)
return np.inf if nans.all() else self._zsortfunc(zs[~nans])

def get_vector(self, segments3d):
"""Optimize points for projection."""
if len(segments3d):
Expand DownExpand Up@@ -815,7 +827,7 @@ def do_3d_projection(self, renderer=None):
if xyzlist:
# sort by depth (furthest drawn first)
z_segments_2d = sorted(
((self._zsortfunc(zs), np.column_stack([xs, ys]), fc, ec, idx)
((self._zsortval(zs), np.column_stack([xs, ys]), fc, ec, idx)
for idx, ((xs, ys, zs), fc, ec)
in enumerate(zip(xyzlist, cface, cedge))),
key=lambda x: x[0], reverse=True)
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp