-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add rc parameters for tight_layout parameters #5271
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
34454a6
to
8210b5c
Compare
Cc: @leejjoon as a tight layout expert |
@@ -1728,6 +1730,10 @@ def tight_layout(self, renderer=None, pad=1.08, h_pad=None, | |||
rect=rect) | |||
|
|||
self.subplots_adjust(**kwargs) | |||
self._tight_parameters.update( | |||
(k, v) for k, v in six.iteritems( |
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.
Just do this with a tuple of tuples (('pad', pad), ('h_pad', h_pad)...)
. I think that will be a bit more readable and get rid of the six
usage.
I'll just use this spot to ask about the Currently I think the API is not very intuitive. Problems:
I would prefer something like:
This would naturally not be a backward compatible change. |
To preserve backwards compatibility, calling fig.tight_layout(pad=pad) will set h_pad=w_pad=pad. All three paddings default to 1.08 (in units of font.size).
8210b5c
to
722721e
Compare
@mdboom This might be relevant to the bounding box on the outward ticks. |
The effort here is appreciated, but I am wondering: given that tight_layout is a hack workaround, does it make sense to keep adding to it? Is there a realistic prospect of being able to replace it with a layout engine any time soon? |
I'm going to close as not having traction. Feel free to re-open if someone would like to re-champion... |
The second commit fixes what I think is a bug. Setting the parameters using
fig.tight_layout(…)
would not save them. Not sure about backward compatibility here.To preserve backward compatibility, calling
fig.tight_layout(pad=pad)
will seth_pad = w_pad = pad
. All three paddings default to1.08
(in units offont.size
).This probably needs tests and a what's new entry, but I thought I would propose it first.
Fixes #5266.