Repository navigation
Leave missing data out of the picture; clip far-off geometry - #86
Merged
Merged
Conversation
A NaN or an infinity in plotted data is missing data to matplotlib: a line breaks around it, and a bar, marker or label placed at one is left out. Only plot dropped it before; bar, errorbar, boxplot, contourf, axvline, text and most other plot types handed it to the backends, which wrote NaN into SVG and PDF. Every renderer call of the plotting layer now goes through put_path, put_rect, put_circle, put_markers, put_glyphs and put_image in fplotlib_artist. They leave out what is missing as matplotlib's path handling does, and clip geometry far outside the view to a box ten canvases out, plus what a stroke can reach, so that a fill value of 1e30 under a ylim, or a line a million points long, is drawn where it crosses the view. Strokes and fills are clipped separately, a dash pattern keeps its phase across a cut, and line widths and dash lengths past 1e12 points are drawn as 1e12, which covers anything that can be seen just as fully. A call with nothing missing or far reaches the renderer unchanged, so every existing picture is the same. hist, hist2d, hexbin and pie leave missing values out of their bins and wedges, streamplot ends a line where the field is missing, 3D limits take only finite values, an axis whose every value is missing has no ticks, and an axes or colorbar a layout leaves no room for is not drawn. add_secondary copies its parent, which the caller may pass as cur_i. tests/test_missing.f90 renders 74 plots with NaN, infinite or far-off values in all four formats, and into a renderer that records how far out anything is drawn; none may stop, and no NaN or infinity may reach the SVG, the EPS or the PDF page.
This was referenced Nov 22, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Missing data and far-off geometry in the plotting layer
A NaN or an infinity in plotted data is missing data to matplotlib: a line breaks around it, and a bar, marker or label placed at one is left out. On main, only
plotdropped it;bar,errorbar,boxplot,contourf,axvline,textand most other plot types handed it to the backends, which wroteNaNinto SVG and PDF.put_path,put_rect,put_circle,put_markers,put_glyphsandput_imageinfplotlib_artist.ylim, or a line a million points long, is drawn where it crosses the view.hist_orient's SVG, PDF and EPS: its log-scale bars are 129,507 points tall, and are now cut at the clip box. The picture looks the same.hist,hist2d,hexbinandpieleave missing values out of their bins and wedges.streamplotends a line where the field is missing.add_secondarycopies its parent, which a caller may pass ascur_i.tests/test_missing.f90renders 74 plots with NaN, infinite or far-off values in all four formats, and also into a renderer that records how far out anything is drawn. None may stop, nothing may be drawn past the clip box, and no NaN or infinity may reach the SVG, the EPS or the PDF page.This is part of a stack of five PRs that together are exactly #83 (the final tree of the last one is byte for byte #83's), split so that each can be reviewed and merged on its own. Each one builds and passes the whole test suite with gfortran, gfortran
-O3 -march=native, flang, flang-O3 -march=nativeand LFortran, and the docs build.status_t(the error API)Merge them in order; each PR's base is the one before it. #83 went through 30 rounds of independent review, the last with no blockers.