<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">The <code class="notranslate">horizontalalignment</code> keyword in <a href="https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.suptitle.html" rel="nofollow">suptitle()</a> produces title alignment which is opposite to what I expect from it. Setting <code class="notranslate">horizontalalignment='left'</code> puts the alignment right, and vice versa.</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

for direction in ['left', 'center', 'right']:
    fig = plt.figure()
    fig.suptitle('This is a test title', horizontalalignment=direction)
    plt.subplot(1,1,1)
    plt.plot(range(5),range(5))
    plt.savefig('halign-' + direction + '.png')"><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-k">for</span> <span class="pl-s1">direction</span> <span class="pl-c1">in</span> [<span class="pl-s">'left'</span>, <span class="pl-s">'center'</span>, <span class="pl-s">'right'</span>]:
    <span class="pl-s1">fig</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">figure</span>()
    <span class="pl-s1">fig</span>.<span class="pl-en">suptitle</span>(<span class="pl-s">'This is a test title'</span>, <span class="pl-s1">horizontalalignment</span><span class="pl-c1">=</span><span class="pl-s1">direction</span>)
    <span class="pl-s1">plt</span>.<span class="pl-en">subplot</span>(<span class="pl-c1">1</span>,<span class="pl-c1">1</span>,<span class="pl-c1">1</span>)
    <span class="pl-s1">plt</span>.<span class="pl-en">plot</span>(<span class="pl-en">range</span>(<span class="pl-c1">5</span>),<span class="pl-en">range</span>(<span class="pl-c1">5</span>))
    <span class="pl-s1">plt</span>.<span class="pl-en">savefig</span>(<span class="pl-s">'halign-'</span> <span class="pl-c1">+</span> <span class="pl-s1">direction</span> <span class="pl-c1">+</span> <span class="pl-s">'.png'</span>)</pre></div>
<p dir="auto"><strong>Actual outcome</strong></p>
<p dir="auto"><code class="notranslate">horizontalalignment='left'</code>:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/1325693f54b50f81833a9e6743076b356caf5a5ab8bcccd78ccf0ab9d42be624/68747470733a2f2f6164616d7367616172642e646b2f66696c65735f6e6f6e7075622f68616c69676e2d6c6566742e706e67"><img src="https://camo.githubusercontent.com/1325693f54b50f81833a9e6743076b356caf5a5ab8bcccd78ccf0ab9d42be624/68747470733a2f2f6164616d7367616172642e646b2f66696c65735f6e6f6e7075622f68616c69676e2d6c6566742e706e67" alt="" data-canonical-src="https://adamsgaard.dk/files_nonpub/halign-left.png" style="max-width: 100%;"></a></p>
<p dir="auto"><code class="notranslate">horizontalalignment='center'</code>:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/473d0907351dff94365e026b14e0e0fa03b60caced981ab6db30ed891396506c/68747470733a2f2f6164616d7367616172642e646b2f66696c65735f6e6f6e7075622f68616c69676e2d63656e7465722e706e67"><img src="https://camo.githubusercontent.com/473d0907351dff94365e026b14e0e0fa03b60caced981ab6db30ed891396506c/68747470733a2f2f6164616d7367616172642e646b2f66696c65735f6e6f6e7075622f68616c69676e2d63656e7465722e706e67" alt="" data-canonical-src="https://adamsgaard.dk/files_nonpub/halign-center.png" style="max-width: 100%;"></a></p>
<p dir="auto"><code class="notranslate">horizontalalignment='right'</code>:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/b4a027cabb683892711a8fadaa9c4d06584f22654841b51025a2026938080f05/68747470733a2f2f6164616d7367616172642e646b2f66696c65735f6e6f6e7075622f68616c69676e2d72696768742e706e67"><img src="https://camo.githubusercontent.com/b4a027cabb683892711a8fadaa9c4d06584f22654841b51025a2026938080f05/68747470733a2f2f6164616d7367616172642e646b2f66696c65735f6e6f6e7075622f68616c69676e2d72696768742e706e67" alt="" data-canonical-src="https://adamsgaard.dk/files_nonpub/halign-right.png" style="max-width: 100%;"></a></p>
<p dir="auto"><strong>Expected outcome</strong></p>
<p dir="auto"><code class="notranslate">horizontalalignment='left'</code>:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/b4a027cabb683892711a8fadaa9c4d06584f22654841b51025a2026938080f05/68747470733a2f2f6164616d7367616172642e646b2f66696c65735f6e6f6e7075622f68616c69676e2d72696768742e706e67"><img src="https://camo.githubusercontent.com/b4a027cabb683892711a8fadaa9c4d06584f22654841b51025a2026938080f05/68747470733a2f2f6164616d7367616172642e646b2f66696c65735f6e6f6e7075622f68616c69676e2d72696768742e706e67" alt="" data-canonical-src="https://adamsgaard.dk/files_nonpub/halign-right.png" style="max-width: 100%;"></a></p>
<p dir="auto"><code class="notranslate">horizontalalignment='center'</code>:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/473d0907351dff94365e026b14e0e0fa03b60caced981ab6db30ed891396506c/68747470733a2f2f6164616d7367616172642e646b2f66696c65735f6e6f6e7075622f68616c69676e2d63656e7465722e706e67"><img src="https://camo.githubusercontent.com/473d0907351dff94365e026b14e0e0fa03b60caced981ab6db30ed891396506c/68747470733a2f2f6164616d7367616172642e646b2f66696c65735f6e6f6e7075622f68616c69676e2d63656e7465722e706e67" alt="" data-canonical-src="https://adamsgaard.dk/files_nonpub/halign-center.png" style="max-width: 100%;"></a></p>
<p dir="auto"><code class="notranslate">horizontalalignment='right'</code>:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/1325693f54b50f81833a9e6743076b356caf5a5ab8bcccd78ccf0ab9d42be624/68747470733a2f2f6164616d7367616172642e646b2f66696c65735f6e6f6e7075622f68616c69676e2d6c6566742e706e67"><img src="https://camo.githubusercontent.com/1325693f54b50f81833a9e6743076b356caf5a5ab8bcccd78ccf0ab9d42be624/68747470733a2f2f6164616d7367616172642e646b2f66696c65735f6e6f6e7075622f68616c69676e2d6c6566742e706e67" alt="" data-canonical-src="https://adamsgaard.dk/files_nonpub/halign-left.png" style="max-width: 100%;"></a></p>
<p dir="auto"><strong>Matplotlib version</strong></p>
<ul dir="auto">
<li>Operating system: Tested on OpenBSD (6.6) and Void Linux (x86_64, glibc)</li>
<li>Matplotlib version: Tested on 2.2.4, 3.1.0, 3.1.1, 3.1.2</li>
<li>Matplotlib backend (<code class="notranslate">print(matplotlib.get_backend())</code>): GTK3Agg and agg</li>
<li>Python version: Tested on 3.7.4 and 3.6.9</li>
<li>Jupyter version (if applicable): N/A</li>
<li>Other libraries: N/A</li>
</ul>
<p dir="auto">Matplotlib and Python are installed through the Void linux and OpenBSD distribution packages.</p>
<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto"><code class="notranslate">horizontalalignment = 'left'</code> aligns the title on the right, <code class="notranslate">horizontalalignment = 'right'</code> aligns a short title on the left, <code class="notranslate">horizontalalignment = 'right'</code> displaces a longer title on the far left</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="# Left alignment test, short title
fig = plt.figure(figsize=(9,4))
ax = fig.add_subplot(111)
fig.suptitle('This figure suptitle should be on the left', horizontalalignment = 'left')
ax.set_title('This axis title should be on the left', loc='left');
fig.savefig('left_align.png')

# Right alignment test, short title
fig = plt.figure(figsize=(9,4))
ax = fig.add_subplot(111)
fig.suptitle('This figure suptitle should be on the right', horizontalalignment = 'right')
ax.set_title('This axis title should be on the right', loc='right');
fig.savefig('right_align.png')

# Right alignment test, longer title
fig = plt.figure(figsize=(9,4))
ax = fig.add_subplot(111)
fig.suptitle('This figure suptitle should be on the right but it is far left', horizontalalignment = 'right')
ax.set_title('This axis title should be on the left', loc='left')
fig.savefig('far_left.png');"><pre class="notranslate"><span class="pl-c"># Left alignment test, short title</span>
<span class="pl-s1">fig</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">figure</span>(<span class="pl-s1">figsize</span><span class="pl-c1">=</span>(<span class="pl-c1">9</span>,<span class="pl-c1">4</span>))
<span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-s1">fig</span>.<span class="pl-en">add_subplot</span>(<span class="pl-c1">111</span>)
<span class="pl-s1">fig</span>.<span class="pl-en">suptitle</span>(<span class="pl-s">'This figure suptitle should be on the left'</span>, <span class="pl-s1">horizontalalignment</span> <span class="pl-c1">=</span> <span class="pl-s">'left'</span>)
<span class="pl-s1">ax</span>.<span class="pl-en">set_title</span>(<span class="pl-s">'This axis title should be on the left'</span>, <span class="pl-s1">loc</span><span class="pl-c1">=</span><span class="pl-s">'left'</span>);
<span class="pl-s1">fig</span>.<span class="pl-en">savefig</span>(<span class="pl-s">'left_align.png'</span>)

<span class="pl-c"># Right alignment test, short title</span>
<span class="pl-s1">fig</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">figure</span>(<span class="pl-s1">figsize</span><span class="pl-c1">=</span>(<span class="pl-c1">9</span>,<span class="pl-c1">4</span>))
<span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-s1">fig</span>.<span class="pl-en">add_subplot</span>(<span class="pl-c1">111</span>)
<span class="pl-s1">fig</span>.<span class="pl-en">suptitle</span>(<span class="pl-s">'This figure suptitle should be on the right'</span>, <span class="pl-s1">horizontalalignment</span> <span class="pl-c1">=</span> <span class="pl-s">'right'</span>)
<span class="pl-s1">ax</span>.<span class="pl-en">set_title</span>(<span class="pl-s">'This axis title should be on the right'</span>, <span class="pl-s1">loc</span><span class="pl-c1">=</span><span class="pl-s">'right'</span>);
<span class="pl-s1">fig</span>.<span class="pl-en">savefig</span>(<span class="pl-s">'right_align.png'</span>)

<span class="pl-c"># Right alignment test, longer title</span>
<span class="pl-s1">fig</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">figure</span>(<span class="pl-s1">figsize</span><span class="pl-c1">=</span>(<span class="pl-c1">9</span>,<span class="pl-c1">4</span>))
<span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-s1">fig</span>.<span class="pl-en">add_subplot</span>(<span class="pl-c1">111</span>)
<span class="pl-s1">fig</span>.<span class="pl-en">suptitle</span>(<span class="pl-s">'This figure suptitle should be on the right but it is far left'</span>, <span class="pl-s1">horizontalalignment</span> <span class="pl-c1">=</span> <span class="pl-s">'right'</span>)
<span class="pl-s1">ax</span>.<span class="pl-en">set_title</span>(<span class="pl-s">'This axis title should be on the left'</span>, <span class="pl-s1">loc</span><span class="pl-c1">=</span><span class="pl-s">'left'</span>)
<span class="pl-s1">fig</span>.<span class="pl-en">savefig</span>(<span class="pl-s">'far_left.png'</span>);</pre></div>
<p dir="auto"><strong>Actual outcome</strong></p>

<ul dir="auto">
<li>
<p dir="auto">Left alignment test, short title<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/3726359/45871500-f435b900-bd8d-11e8-9d57-754958f583b4.png"><img src="https://user-images.githubusercontent.com/3726359/45871500-f435b900-bd8d-11e8-9d57-754958f583b4.png" alt="left_align" style="max-width: 100%;"></a></p>
</li>
<li>
<p dir="auto">Right alignment test, short title<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/3726359/45871566-116a8780-bd8e-11e8-968c-58f873505e19.png"><img src="https://user-images.githubusercontent.com/3726359/45871566-116a8780-bd8e-11e8-968c-58f873505e19.png" alt="right_align" style="max-width: 100%;"></a></p>
</li>
<li>
<p dir="auto">Right alignment test, longer title<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/3726359/45871581-192a2c00-bd8e-11e8-8540-e78304e9ccc6.png"><img src="https://user-images.githubusercontent.com/3726359/45871581-192a2c00-bd8e-11e8-8540-e78304e9ccc6.png" alt="far_left" style="max-width: 100%;"></a></p>
</li>
</ul>
<p dir="auto"><strong>Expected outcome</strong></p>
<p dir="auto">The following code manually sets the figure title at the expected position:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="fig = plt.figure(figsize=(9,4))
ax = fig.add_subplot(111)
fig.suptitle('This figure suptitle is long but it is manually positioned', x = 0.38)
ax.set_title('This axis title should be on the left', loc='left')
fig.savefig('manual_pos.png');"><pre class="notranslate"><span class="pl-s1">fig</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">figure</span>(<span class="pl-s1">figsize</span><span class="pl-c1">=</span>(<span class="pl-c1">9</span>,<span class="pl-c1">4</span>))
<span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-s1">fig</span>.<span class="pl-en">add_subplot</span>(<span class="pl-c1">111</span>)
<span class="pl-s1">fig</span>.<span class="pl-en">suptitle</span>(<span class="pl-s">'This figure suptitle is long but it is manually positioned'</span>, <span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-c1">0.38</span>)
<span class="pl-s1">ax</span>.<span class="pl-en">set_title</span>(<span class="pl-s">'This axis title should be on the left'</span>, <span class="pl-s1">loc</span><span class="pl-c1">=</span><span class="pl-s">'left'</span>)
<span class="pl-s1">fig</span>.<span class="pl-en">savefig</span>(<span class="pl-s">'manual_pos.png'</span>);</pre></div>
<p dir="auto">Which gives:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/3726359/45871836-b4bb9c80-bd8e-11e8-94e9-e453adc39fda.png"><img src="https://user-images.githubusercontent.com/3726359/45871836-b4bb9c80-bd8e-11e8-94e9-e453adc39fda.png" alt="manual_pos" style="max-width: 100%;"></a></p>


<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>Operating system: Windows</li>
<li>Matplotlib version: 2.1.2 and 2.2.3</li>
<li>Matplotlib backend: agg</li>
<li>Python version: 3.6.4</li>
<li>Jupyter version: 4.4.0</li>
</ul>