Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Backport PR #12709 on branch v3.0.x (Correctly remove nans when drawing paths with pycairo.) #12710

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
Changes from all 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
5 changes: 3 additions & 2 deletions lib/matplotlib/backends/backend_cairo.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ def buffer_info(self):

def _append_paths_slow(ctx, paths, transforms, clip=None):
for path, transform in zip(paths, transforms):
for points, code in path.iter_segments(transform, clip=clip):
for points, code in path.iter_segments(
transform, remove_nans=True, clip=clip):
if code == Path.MOVETO:
ctx.move_to(*points)
elif code == Path.CLOSEPOLY:
Expand Down Expand Up @@ -118,7 +119,7 @@ def _append_paths_fast(ctx, paths, transforms, clip=None):
# Convert curves to segment, so that 1. we don't have to handle
# variable-sized CURVE-n codes, and 2. we don't have to implement degree
# elevation for quadratic Beziers.
cleaneds = [path.cleaned(transform=transform, clip=clip, curves=False)
cleaneds = [path.cleaned(transform, remove_nans=True, clip=clip)
for path, transform in zip(paths, transforms)]
vertices = np.concatenate([cleaned.vertices for cleaned in cleaneds])
codes = np.concatenate([cleaned.codes for cleaned in cleaneds])
Expand Down