-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
ENH: Compressed layout for fixed-aspect axes #17246
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Remilestoned for 3.4, but would be nice to get some comment for this. Is a string value for the I think it would be possible for the just to be run all the time when CL is turned on; its quite fast, but I've not tried every weird combo of axes yet. I also think it would be possible to run this stand-alone. |
Are the axes not squished horizontally because of the long xlabels? If so it may be nice to provide an example where squishing occurs in both directions. |
@anntzer Not quite sure what you mean. The aspect ratio of the figure is such that squishing only happens in x in this case, but if the aspect ratios were swapped the squishing happens in x. If you mean the spacing is different between the axes in x and y, then yes, thats because of the large x-labels. The point of constrained_layout is non-overlapping labels, so thats a feature, not a bug. If instead we want a layout where labels are allowed to overlap and the plot positions are simply a fixed distance apart, then that is really a lot easier than what is done here since you can do all the positioning with the axes positions and don't need to know about the size of the decorations. |
8bf58b8
to
a95ac4a
Compare
718edaa
to
523ffee
Compare
**self._tight_parameters) | ||
# convert pads to inches... | ||
fs = FontProperties(size=mpl.rcParams["font.size"]) | ||
fs = fs.get_size_in_points() / 72 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This flake8 error looks spurious?
I'm closing this, not because I think its a bad idea, but because it needs to be substantially revised with the new CL changes. |
PR Summary
EDIT 5 May: new write up here...
Adds a new layout option
compress_layout=True
toFigure.figure
. This option attempts to compress axes if they are too far apart because of fixed aspect ratios....This is most feature complete with
constrained_layout=True
, but works if folks don't use colorbars for no layout ortight_layout
. The real issue is that we cannot handle nested gridspecs with this, and colorbars, by default, are nested gridspecs. (Don't get me started on how we make colorbars - I think that needs a rethink).See new example: https://36260-1385122-gh.circle-artifacts.com/0/doc/build/html/gallery/subplots_axes_and_figures/compress_axes.html#sphx-glr-gallery-subplots-axes-and-figures-compress-axes-py
Before:
After
PR Checklist
suptitle!
Has Pytest style unit tests
Code is Flake 8 compliant
New features are documented, with examples if plot related
Documentation is sphinx and numpydoc compliant
Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way