Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ENH: constrained_layout simple compress axes#20016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
jklymak wants to merge2 commits intomatplotlib:mainfromjklymak:enh-compress-axes

Conversation

jklymak
Copy link
Member

PR Summary

We often have the situation where we have a grid of fixed-aspect axes, and they end up with too much space in one direction or the other:

CompressFalse

For simple cases, it is not hard to fix this, as is done with this PR:

CompressTrue

API:

As with previous efforts at doing this the API is a bit klunky, but I think it needs to be optional so we need something.

importmatplotlib.pyplotaspltimportnumpyasnpnrows=2ncols=3forcompressin [False,True]:fig,axs=plt.subplots(nrows,ncols,figsize=(4,4),constrained_layout={'compress':compress},sharex=True,sharey=True)fig.patch.set_facecolor("0.9")#fig.set_constrained_layout_pads(compress=True)foriinrange(nrows):forjinrange(ncols):ax=axs[i,j]ax.set_aspect(1)pc=ax.pcolormesh(np.random.randn(30,30))fig.colorbar(pc,ax=axs)fig.savefig(f'/Users/jklymak/downloads/Compress{compress}.png',dpi=100)

PR Checklist

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (runflake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • Conforms to Matplotlib style conventions (installflake8-docstrings and runflake8 --docstring-convention=all).
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).

@jklymakjklymak marked this pull request as draftApril 19, 2021 00:38
@jklymakjklymak added the topic: geometry managerLayoutEngine, Constrained layout, Tight layout labelApr 19, 2021
@anntzer
Copy link
Contributor

Possibly the API discussion should be done as part of#19892? e.g.layout="constrained-compressed" (or even just "compressed")

@jklymak
Copy link
MemberAuthor

Closing for#22289

@jklymakjklymak deleted the enh-compress-axes branchJanuary 22, 2022 17:42
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
status: waiting for other PRtopic: geometry managerLayoutEngine, Constrained layout, Tight layout
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@jklymak@anntzer

[8]ページ先頭

©2009-2025 Movatter.jp