Skip to content

Support col_wrap="auto"#11266

Open
headtr1ck wants to merge 7 commits intopydata:mainfrom
headtr1ck:auto-col
Open

Support col_wrap="auto"#11266
headtr1ck wants to merge 7 commits intopydata:mainfrom
headtr1ck:auto-col

Conversation

@headtr1ck
Copy link
Copy Markdown
Collaborator

@headtr1ck headtr1ck commented Mar 26, 2026

  • Tests added
  • User visible changes (including notable bug fixes) are documented in whats-new.rst

I often ended up writing this logic myself, better to make it as part of xarray.

While implementing it I noticed this comment:

idea - could add heuristic for nice shapes like 3x4

That should be covered now :)

@headtr1ck
Copy link
Copy Markdown
Collaborator Author

It would maybe be nice to not wrap 3 elements? But I guess that is debatable.

@headtr1ck
Copy link
Copy Markdown
Collaborator Author

v2 now takes into account the figsize if specified.
e.g. a figsize of (12, 6) and 8 images would result in a grid of 2x4.

@headtr1ck
Copy link
Copy Markdown
Collaborator Author

headtr1ck commented Mar 27, 2026

v3 now supports aspect as well.
Here some examples:

image image image image image image image image image image image

kkollsga added a commit to kkollsga/xarray that referenced this pull request Mar 29, 2026
Extend facetgrid_figsize to accept a (width, height) tuple in addition
to "computed" and "rcparams". Also move figsize resolution before grid
shape computation for better composition with col_wrap="auto" (pydata#11266).

Co-authored-by: Claude <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@Illviljan Illviljan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks very nice!

In V1 I had some thoughts of maybe calling the option "square" since it always strived towards that. But now it's clever enough for the generic "auto" I think.

Comment on lines -204 to -205
if row:
ncol = 1
Copy link
Copy Markdown
Contributor

@Illviljan Illviljan Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

row was not needed due to single_group=True. (either row or col is defined)

@headtr1ck headtr1ck added the plan to merge Final call for comments label Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plan to merge Final call for comments topic-plotting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants