Skip to content

Reject scalar coordinates as plot axes#11450

Draft
sdraeger wants to merge 1 commit into
pydata:mainfrom
sdraeger:fix-facetgrid-scalar-axis
Draft

Reject scalar coordinates as plot axes#11450
sdraeger wants to merge 1 commit into
pydata:mainfrom
sdraeger:fix-facetgrid-scalar-axis

Conversation

@sdraeger

@sdraeger sdraeger commented Jul 13, 2026

Copy link
Copy Markdown

Description

Closes #7333.

Facet coordinates remain attached as zero-dimensional coordinates after FacetGrid selects each panel. _infer_xy_labels accepted those coordinates as plotting axes, causing the 2D plotting code to index a nonexistent first dimension and raise IndexError.

This change rejects zero-dimensional x/y coordinates during label inference and raises a clear ValueError instead. It also adds a regression test covering a faceting coordinate passed as an axis.

Tests

  • uv run pytest xarray/tests/test_plot.py
  • pre-commit run --files xarray/plot/utils.py xarray/tests/test_plot.py

Checklist

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.
      Tools: Codex

Co-authored-by: Codex <noreply@anthropic.com>
@welcome

welcome Bot commented Jul 13, 2026

Copy link
Copy Markdown

Thank you for opening this pull request! It may take us a few days to respond here, so thank you for being patient.
If you have questions, some answers may be found in our contributing guidelines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FacetGrid with coords error

1 participant