Skip to content

Conversation

cvanelteren
Copy link
Collaborator

@cvanelteren cvanelteren commented Oct 4, 2025

Closes #356 and #358

This PR addresses two critical bugs introduced after v1.0: one causing incorrect indexing in SubplotGrid, and another causing sequential format calls on GeoAxes to override each other.

While this work is part of the larger effort in #349, this fix is being prioritized to resolve significant issues for users on the latest version.

Gridspec Indexing Bug

  • The Issue: Slicing a SubplotGrid using 2D grid coordinates (e.g., axs[:, 0]) resulted in an incorrect selection of axes.
  • The Fix: The SubplotGrid.__getitem__ method in ultraplot/gridspec.py has been reverted to the robust implementation from v1.0, which correctly handles array-like indexing.

Sequential Formatting Bug

  • The Issue: When applying formatting to a GeoAxes object in sequence, the second call would override the first. For example, setting longitude labels with ax.format(lonlabels=True) and then latitude labels with ax.format(latlabels=True) would result in only the latitude labels being displayed.
  • The Fix: The internal helper function _to_label_array in ultraplot/axes/geo.py was incorrectly defaulting unspecified label sides to False. It has been modified to use None instead, ensuring that only the explicitly passed labels are modified and preserving the state of other labels from previous format calls.

@cvanelteren cvanelteren requested a review from Copilot October 4, 2025 06:38
Copilot

This comment was marked as resolved.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@cvanelteren cvanelteren marked this pull request as draft October 4, 2025 06:40
Copy link

codecov bot commented Oct 4, 2025

Codecov Report

❌ Patch coverage is 95.58824% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
ultraplot/gridspec.py 89.65% 1 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@cvanelteren cvanelteren added this to the v1.60.4 milestone Oct 4, 2025
@cvanelteren cvanelteren requested a review from beckermr October 4, 2025 07:14
@cvanelteren cvanelteren marked this pull request as ready for review October 4, 2025 07:14
@cvanelteren cvanelteren marked this pull request as draft October 4, 2025 10:37
@cvanelteren
Copy link
Collaborator Author

cvanelteren commented Oct 4, 2025

Restored indexing, but found another bug. The subplot spec for panels are not correctly returned with this manner of slicing. Think this is a minor issue but should be addressed on the future.

The issue occurs for irregular layouts; otherwise it is not a problem.
fixed

@cvanelteren cvanelteren marked this pull request as ready for review October 4, 2025 14:26
@cvanelteren cvanelteren modified the milestones: v1.60.4, v161.2 Oct 8, 2025
@beckermr beckermr merged commit c8b6183 into Ultraplot:main Oct 8, 2025
25 checks passed
@cvanelteren cvanelteren deleted the hotfix-grid-index branch October 8, 2025 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Something is wrong with axs 2D indexing for geographic plots

2 participants