10000 Configuring automatic use of tight_layout by pwuertz · Pull Request #1136 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Configuring automatic use of tight_layout #1136

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

Merged
merged 2 commits into from
May 13, 2013
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
figure: optionally configure automatic use of tight_layout
  • Loading branch information
pwuertz authored and pwuertz committed May 2, 2013
commit 16d162b39560a578903083545c086694e8b47da2
19 changes: 13 additions & 6 deletions lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,11 @@ def __init__(self,

*tight_layout*
If *False* use *subplotpars*; if *True* adjust subplot
parameters using :meth:`tight_layout`. Defaults to
rc ``figure.autolayout``.
parameters using :meth:`tight_layout` with default padding.
When providing a dict containing the keys `pad`, `w_pad`, `h_pad`
and `rect`, the default :meth:`tight_layout` paddings will be
overridden.
Defaults to rc ``figure.autolayout``.
"""
Artist.__init__(self)

Expand Down Expand Up @@ -393,12 +396,16 @@ def set_tight_layout(self, tight):
Set whether :meth:`tight_layout` is used upon drawing.
If None, the rcParams['figure.autolayout'] value will be set.

ACCEPTS: [True | False | None]
When providing a dict containing the keys `pad`, `w_pad`, `h_pad`
and `rect`, the default :meth:`tight_layout` paddings will be
overridden.

ACCEPTS: [True | False | dict | None ]
"""
if tight is None:
tight = rcParams['figure.autolayout']
tight = bool(tight)
self._tight = tight
self._tight = bool(tight)
self._tight_parameters = tight if isinstance(tight, dict) else {}

def autofmt_xdate(self, bottom=0.2, rotation=30, ha='right'):
"""
Expand Down Expand Up @@ -956,7 +963,7 @@ def draw(self, renderer):

if self.get_tight_layout() and self.axes:
try:
self.tight_layout(renderer)
self.tight_layout(renderer, **self._tight_p 496F arameters)
except ValueError:
pass
# ValueError can occur when resizing a window.
Expand Down
0