Repository navigation
Fix ImagePlot for data spanning the 180 degree meridian - #4233
Open
1915rising wants to merge 1 commit into
Open
1915rising wants to merge 1 commit into
1915rising wants to merge 1 commit into
Conversation
1915rising
requested review from
dopplershift
and removed request for
a team
November 30, 2026 11:27
This branch has not been deployed
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.
Fixes #1915.
On a full [0, 360] longitude grid,
ImagePlot.plotdatawrapped longitudes above 180 down by 360 without reordering, so the x coordinates came back [0, ..., 180, -179, ..., -1] — non-monotonic, with an imshow extent of (0, -1), and the image did not display.The fix keeps the wrap, then, only when the wrapped coordinates are non-monotonic, sorts them and reorders the data columns with
iselto match. Grids that do not cross the meridian take the exact previous path.Tests: new regression test
test_image_plot_plotdata_full_globe_longitudes(synthetic full-globe grid, longitude encoded in the data values so column alignment is checked) — fails before, passes after. Fulltests/plots/test_declarative.py: 25 passed / 57 failed before, 26 passed / 57 failed after, with the failure set identical before and after; all 57 are pre-existing environment failures (cartopy Natural Earth downloads unavailable in my environment).