<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">When using both <code class="notranslate">title</code> and <code class="notranslate">suptitle</code> with <code class="notranslate">constrained_layout</code>, titles overlap.</p>
<p dir="auto"><strong>Code for reproduction</strong></p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import matplotlib.pyplot as plt
plt.rcParams = plt.rcParamsDefault
plt.rcParams['figure.constrained_layout.use'] = True
plt.title('Test with b')
plt.suptitle('Test with p')"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>
<span class="pl-s1">plt</span>.<span class="pl-s1">rcParams</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-s1">rcParamsDefault</span>
<span class="pl-s1">plt</span>.<span class="pl-s1">rcParams</span>[<span class="pl-s">'figure.constrained_layout.use'</span>] <span class="pl-c1">=</span> <span class="pl-c1">True</span>
<span class="pl-s1">plt</span>.<span class="pl-en">title</span>(<span class="pl-s">'Test with b'</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">suptitle</span>(<span class="pl-s">'Test with p'</span>)</pre></div>
<p dir="auto">Other possibility is the exact demonstration that is used to work by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jklymak/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/jklymak">@jklymak</a> <a href="https://github.com/matplotlib/matplotlib/issues/5355#issuecomment-441287273" data-hovercard-type="issue" data-hovercard-url="/matplotlib/matplotlib/issues/5355/hovercard">here</a>, hence the “Regression?” tag in the title. I don’t have time to bisect currently though…</p>
<p dir="auto"><strong>Actual outcome</strong></p>
<p dir="auto"><a href="https://github.com/matplotlib/matplotlib/files/3167592/test.pdf">test.pdf</a></p>
<p dir="auto"><strong>Expected outcome</strong></p>
<p dir="auto">Titles are spaced correctly.</p>
<p dir="auto"><strong>Matplotlib version</strong></p>
<ul dir="auto">
<li>Operating system: ArchLinux</li>
<li>Matplotlib version: 3.1rc2</li>
<li>Matplotlib backend (<code class="notranslate">print(matplotlib.get_backend())</code>): multiple</li>
<li>Python version: 3.7.3</li>
</ul>
<p dir="auto">Python and matplotlib are distro packages.</p>
<p dir="auto">I want to add a title to a matplotlib figure. Using the newer <code class="notranslate">constrained_layout</code> the title is nicely aligned with the axis.</p>
<p dir="auto">Unfortunately under certain circumstances the layout still overlaps as shown in the following examples in the Jupyter notebook (with different backends):</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="%matplotlib notebook 
import numpy as np
from matplotlib import pyplot as plt

# example with low height
fig, axes = plt.subplots(nrows=2, ncols=2, figsize=(6, 3), constrained_layout=True)
axes[0,0].plot([0,1,2], label='test')
axes[1,0].plot([0,1,2], label='test 2')
fig.suptitle('a longer title') "><pre class="notranslate"><span class="pl-c1">%</span><span class="pl-s1">matplotlib</span> <span class="pl-s1">notebook</span> 
<span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-k">from</span> <span class="pl-s1">matplotlib</span> <span class="pl-k">import</span> <span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>

<span class="pl-c"># example with low height</span>
<span class="pl-s1">fig</span>, <span class="pl-s1">axes</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">subplots</span>(<span class="pl-s1">nrows</span><span class="pl-c1">=</span><span class="pl-c1">2</span>, <span class="pl-s1">ncols</span><span class="pl-c1">=</span><span class="pl-c1">2</span>, <span class="pl-s1">figsize</span><span class="pl-c1">=</span>(<span class="pl-c1">6</span>, <span class="pl-c1">3</span>), <span class="pl-s1">constrained_layout</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)
<span class="pl-s1">axes</span>[<span class="pl-c1">0</span>,<span class="pl-c1">0</span>].<span class="pl-en">plot</span>([<span class="pl-c1">0</span>,<span class="pl-c1">1</span>,<span class="pl-c1">2</span>], <span class="pl-s1">label</span><span class="pl-c1">=</span><span class="pl-s">'test'</span>)
<span class="pl-s1">axes</span>[<span class="pl-c1">1</span>,<span class="pl-c1">0</span>].<span class="pl-en">plot</span>([<span class="pl-c1">0</span>,<span class="pl-c1">1</span>,<span class="pl-c1">2</span>], <span class="pl-s1">label</span><span class="pl-c1">=</span><span class="pl-s">'test 2'</span>)
<span class="pl-s1">fig</span>.<span class="pl-en">suptitle</span>(<span class="pl-s">'a longer title'</span>) </pre></div>
<p dir="auto">This results in<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/5851636/54355839-6c54ab80-465a-11e9-8c29-ecc19e7cebf7.png"><img src="https://user-images.githubusercontent.com/5851636/54355839-6c54ab80-465a-11e9-8c29-ecc19e7cebf7.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">But now increasing the plot height using the modified example</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="[...]
fig, axes = plt.subplots(nrows=2, ncols=2, figsize=(6, 12), constrained_layout=True)
[...]"><pre class="notranslate">[...]
<span class="pl-s1">fig</span>, <span class="pl-s1">axes</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">subplots</span>(<span class="pl-s1">nrows</span><span class="pl-c1">=</span><span class="pl-c1">2</span>, <span class="pl-s1">ncols</span><span class="pl-c1">=</span><span class="pl-c1">2</span>, <span class="pl-s1">figsize</span><span class="pl-c1">=</span>(<span class="pl-c1">6</span>, <span class="pl-c1">12</span>), <span class="pl-s1">constrained_layout</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)
[...]</pre></div>
<p dir="auto">shows the following overlapping title:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/5851636/54355911-9ad28680-465a-11e9-89b8-0c61cf9fc6d2.png"><img src="https://user-images.githubusercontent.com/5851636/54355911-9ad28680-465a-11e9-89b8-0c61cf9fc6d2.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">Is there anything that can be done here to find out why this is not taking into account the larger plot dimensions?</p>
<p dir="auto"><em>Originally posted by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/asteppke/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/asteppke">@asteppke</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="114199762" data-permission-text="Title is private" data-url="https://github.com/matplotlib/matplotlib/issues/5355" data-hovercard-type="issue" data-hovercard-url="/matplotlib/matplotlib/issues/5355/hovercard?comment_id=472828628&amp;comment_type=issue_comment" href="https://github.com/matplotlib/matplotlib/issues/5355#issuecomment-472828628">#5355 (comment)</a></em></p>