8000 Merge pull request #10640 from anntzer/constrainedwarning · matplotlib/matplotlib@433afcf · GitHub
[go: up one dir, main page]

Skip to content

Commit 433afcf

Browse files
authored
Merge pull request #10640 from anntzer/constrainedwarning
Fix extra and missing spaces in constrainedlayout warning.
2 parents 2d14a31 + 51c782e commit 433afcf

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

lib/matplotlib/figure.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2195,7 +2195,7 @@ def get_tightbbox(self, renderer):
21952195

21962196
def init_layoutbox(self):
21972197
"""
2198-
initilaize the layoutbox for use in constrained_layout.
2198+
Initialize the layoutbox for use in constrained_layout.
21992199
"""
22002200
if self._layoutbox is None:
22012201
self._layoutbox = layoutbox.LayoutBox(parent=None,
@@ -2207,23 +2207,21 @@ def execute_constrained_layout(self, renderer=None):
22072207
"""
22082208
Use ``layoutbox`` to determine pos positions within axes.
22092209
2210-
See also set_constrained_layout_pads
2210+
See also set_constrained_layout_pads.
22112211
"""
22122212

2213-
from matplotlib._constrained_layout import (do_constrained_layout)
2213+
from matplotlib._constrained_layout import do_constrained_layout
22142214

22152215
_log.debug('Executing constrainedlayout')
22162216
if self._layoutbox is None:
2217-
warnings.warn("Calling figure.constrained_layout, but figure "
2218-
"not setup to do constrained layout. "
2219-
" You either called GridSpec without the "
2220-
"fig keyword, you are using plt.subplot, "
2221-
"or you need to call figure or subplots"
2222-
"with the constrained_layout=True kwarg.")
2217+
warnings.warn("Calling figure.constrained_layout, but figure not "
2218+
"setup to do constrained layout. You either called "
2219+
"GridSpec without the fig keyword, you are using "
2220+
"plt.subplot, or you need to call figure or "
2221+
"subplots with the constrained_layout=True kwarg.")
22232222
return
22242223
w_pad, h_pad, wspace, hspace = self.get_constrained_layout_pads()
22252224
# convert to unit-relative lengths
2226-
22272225
fig = self
22282226
width, height = fig.get_size_inches()
22292227
w_pad = w_pad / width

0 commit comments

Comments
 (0)
0