Skip to content

Added rc parameters for tight_layout #12365

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

Closed
wants to merge 4 commits into from

Conversation

ConnorBrooks8
Copy link

@ConnorBrooks8 ConnorBrooks8 commented Oct 2, 2018

added rc parameters for tight_layout padding

PR Summary

Fixes #5266.
-added properties in matplotlibrc and rcsetup
-replaced hardcoded values in tight_layout.py with the new rc properties

PR Checklist

  • 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

@@ -36,7 +36,8 @@ def _get_top(tight_bbox, axes_bbox):

def auto_adjust_subplotpars(
fig, renderer, nrows_ncols, num1num2_list, subplot_list,
ax_bbox_list=None, pad=1.08, h_pad=None, w_pad=None, rect=None):
ax_bbox_list=None, pad=rcParams['figure.tight_layout.pad'],
h_pad=rcParams['figure.tight_layout.h_pad'], w_pad=rcParams['figure.tight_layout.w_pad'], rect=None):

Choose a reason for hiding this comment

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

Note that it's quite uncommon to have the rcParams being evaluated within the function signature. I think this would at least become a problem with the rc_context manager. Better keep the paramers as None and set the values within the function (if param is None: ...).

Copy link
Member

Choose a reason for hiding this comment

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

In fact, this is not just uncommon, but it will not work as expected. The rcParams would be resolved when the function is read from the file but the intent is for them to be resolved when the function is called.

@ImportanceOfBeingErnest ImportanceOfBeingErnest changed the title Issue5266 - added rc parameters for tight_layout Added rc parameters for tight_layout Oct 2, 2018
@ImportanceOfBeingErnest
Copy link
Member

Can this get a test? Meaning you can test if putting some parameters into the rcParams and calling tight_layout() gives the same result as calling tight_layout(pad=..., h_pad=...) by accessing the figure.subplotparams.

Copy link
Member

@QuLogic QuLogic left a comment

Choose a reason for hiding this comment

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

Please correct the default parameters.

@@ -36,7 +36,8 @@ def _get_top(tight_bbox, axes_bbox):

def auto_adjust_subplotpars(
fig, renderer, nrows_ncols, num1num2_list, subplot_list,
ax_bbox_list=None, pad=1.08, h_pad=None, w_pad=None, rect=None):
ax_bbox_list=None, pad=rcParams['figure.tight_layout.pad'],
h_pad=rcParams['figure.tight_layout.h_pad'], w_pad=rcParams['figure.tight_layout.w_pad'], rect=None):
Copy link
Member

Choose a reason for hiding this comment

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

In fact, this is not just uncommon, but it will not work as expected. The rcParams would be resolved when the function is read from the file but the intent is for them to be resolved when the function is called.

@timhoffm
Copy link
Member

Closing due to lack of feedback. In the current form this is not a valid solution to #5266.

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.

Add an rc file setting for the pad parameter of tight_layout
4 participants