<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">Matplotlib patch 3.1.1 broke imshow() heatmaps. While with version 3.1.0 the heatmap was plotted correctly, in 3.1.1 the bottom most and the top most heatmap tiles are cut off.<br>
This can even be seen in the Matplotlib online documentation itself, see links below.</p>
<p dir="auto"><strong>Code for reproduction</strong></p>
<p dir="auto">Taken straight from the Matplotlib online documentation:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy as np
import matplotlib
import matplotlib.pyplot as plt
# sphinx_gallery_thumbnail_number = 2

vegetables = [&quot;cucumber&quot;, &quot;tomato&quot;, &quot;lettuce&quot;, &quot;asparagus&quot;,
              &quot;potato&quot;, &quot;wheat&quot;, &quot;barley&quot;]
farmers = [&quot;Farmer Joe&quot;, &quot;Upland Bros.&quot;, &quot;Smith Gardening&quot;,
           &quot;Agrifun&quot;, &quot;Organiculture&quot;, &quot;BioGoods Ltd.&quot;, &quot;Cornylee Corp.&quot;]

harvest = np.array([[0.8, 2.4, 2.5, 3.9, 0.0, 4.0, 0.0],
                    [2.4, 0.0, 4.0, 1.0, 2.7, 0.0, 0.0],
                    [1.1, 2.4, 0.8, 4.3, 1.9, 4.4, 0.0],
                    [0.6, 0.0, 0.3, 0.0, 3.1, 0.0, 0.0],
                    [0.7, 1.7, 0.6, 2.6, 2.2, 6.2, 0.0],
                    [1.3, 1.2, 0.0, 0.0, 0.0, 3.2, 5.1],
                    [0.1, 2.0, 0.0, 1.4, 0.0, 1.9, 6.3]])


fig, ax = plt.subplots()
im = ax.imshow(harvest)

# We want to show all ticks...
ax.set_xticks(np.arange(len(farmers)))
ax.set_yticks(np.arange(len(vegetables)))
# ... and label them with the respective list entries
ax.set_xticklabels(farmers)
ax.set_yticklabels(vegetables)

# Rotate the tick labels and set their alignment.
plt.setp(ax.get_xticklabels(), rotation=45, ha=&quot;right&quot;,
         rotation_mode=&quot;anchor&quot;)

# Loop over data dimensions and create text annotations.
for i in range(len(vegetables)):
    for j in range(len(farmers)):
        text = ax.text(j, i, harvest[i, j],
                       ha=&quot;center&quot;, va=&quot;center&quot;, color=&quot;w&quot;)

ax.set_title(&quot;Harvest of local farmers (in tons/year)&quot;)
fig.tight_layout()
plt.show()"><pre class="notranslate"><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">import</span> <span class="pl-s1">matplotlib</span>
<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-c"># sphinx_gallery_thumbnail_number = 2</span>

<span class="pl-s1">vegetables</span> <span class="pl-c1">=</span> [<span class="pl-s">"cucumber"</span>, <span class="pl-s">"tomato"</span>, <span class="pl-s">"lettuce"</span>, <span class="pl-s">"asparagus"</span>,
              <span class="pl-s">"potato"</span>, <span class="pl-s">"wheat"</span>, <span class="pl-s">"barley"</span>]
<span class="pl-s1">farmers</span> <span class="pl-c1">=</span> [<span class="pl-s">"Farmer Joe"</span>, <span class="pl-s">"Upland Bros."</span>, <span class="pl-s">"Smith Gardening"</span>,
           <span class="pl-s">"Agrifun"</span>, <span class="pl-s">"Organiculture"</span>, <span class="pl-s">"BioGoods Ltd."</span>, <span class="pl-s">"Cornylee Corp."</span>]

<span class="pl-s1">harvest</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">array</span>([[<span class="pl-c1">0.8</span>, <span class="pl-c1">2.4</span>, <span class="pl-c1">2.5</span>, <span class="pl-c1">3.9</span>, <span class="pl-c1">0.0</span>, <span class="pl-c1">4.0</span>, <span class="pl-c1">0.0</span>],
                    [<span class="pl-c1">2.4</span>, <span class="pl-c1">0.0</span>, <span class="pl-c1">4.0</span>, <span class="pl-c1">1.0</span>, <span class="pl-c1">2.7</span>, <span class="pl-c1">0.0</span>, <span class="pl-c1">0.0</span>],
                    [<span class="pl-c1">1.1</span>, <span class="pl-c1">2.4</span>, <span class="pl-c1">0.8</span>, <span class="pl-c1">4.3</span>, <span class="pl-c1">1.9</span>, <span class="pl-c1">4.4</span>, <span class="pl-c1">0.0</span>],
                    [<span class="pl-c1">0.6</span>, <span class="pl-c1">0.0</span>, <span class="pl-c1">0.3</span>, <span class="pl-c1">0.0</span>, <span class="pl-c1">3.1</span>, <span class="pl-c1">0.0</span>, <span class="pl-c1">0.0</span>],
                    [<span class="pl-c1">0.7</span>, <span class="pl-c1">1.7</span>, <span class="pl-c1">0.6</span>, <span class="pl-c1">2.6</span>, <span class="pl-c1">2.2</span>, <span class="pl-c1">6.2</span>, <span class="pl-c1">0.0</span>],
                    [<span class="pl-c1">1.3</span>, <span class="pl-c1">1.2</span>, <span class="pl-c1">0.0</span>, <span class="pl-c1">0.0</span>, <span class="pl-c1">0.0</span>, <span class="pl-c1">3.2</span>, <span class="pl-c1">5.1</span>],
                    [<span class="pl-c1">0.1</span>, <span class="pl-c1">2.0</span>, <span class="pl-c1">0.0</span>, <span class="pl-c1">1.4</span>, <span class="pl-c1">0.0</span>, <span class="pl-c1">1.9</span>, <span class="pl-c1">6.3</span>]])


<span class="pl-s1">fig</span>, <span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">subplots</span>()
<span class="pl-s1">im</span> <span class="pl-c1">=</span> <span class="pl-s1">ax</span>.<span class="pl-en">imshow</span>(<span class="pl-s1">harvest</span>)

<span class="pl-c"># We want to show all ticks...</span>
<span class="pl-s1">ax</span>.<span class="pl-en">set_xticks</span>(<span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-en">len</span>(<span class="pl-s1">farmers</span>)))
<span class="pl-s1">ax</span>.<span class="pl-en">set_yticks</span>(<span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-en">len</span>(<span class="pl-s1">vegetables</span>)))
<span class="pl-c"># ... and label them with the respective list entries</span>
<span class="pl-s1">ax</span>.<span class="pl-en">set_xticklabels</span>(<span class="pl-s1">farmers</span>)
<span class="pl-s1">ax</span>.<span class="pl-en">set_yticklabels</span>(<span class="pl-s1">vegetables</span>)

<span class="pl-c"># Rotate the tick labels and set their alignment.</span>
<span class="pl-s1">plt</span>.<span class="pl-en">setp</span>(<span class="pl-s1">ax</span>.<span class="pl-en">get_xticklabels</span>(), <span class="pl-s1">rotation</span><span class="pl-c1">=</span><span class="pl-c1">45</span>, <span class="pl-s1">ha</span><span class="pl-c1">=</span><span class="pl-s">"right"</span>,
         <span class="pl-s1">rotation_mode</span><span class="pl-c1">=</span><span class="pl-s">"anchor"</span>)

<span class="pl-c"># Loop over data dimensions and create text annotations.</span>
<span class="pl-k">for</span> <span class="pl-s1">i</span> <span class="pl-c1">in</span> <span class="pl-en">range</span>(<span class="pl-en">len</span>(<span class="pl-s1">vegetables</span>)):
    <span class="pl-k">for</span> <span class="pl-s1">j</span> <span class="pl-c1">in</span> <span class="pl-en">range</span>(<span class="pl-en">len</span>(<span class="pl-s1">farmers</span>)):
        <span class="pl-s1">text</span> <span class="pl-c1">=</span> <span class="pl-s1">ax</span>.<span class="pl-en">text</span>(<span class="pl-s1">j</span>, <span class="pl-s1">i</span>, <span class="pl-s1">harvest</span>[<span class="pl-s1">i</span>, <span class="pl-s1">j</span>],
                       <span class="pl-s1">ha</span><span class="pl-c1">=</span><span class="pl-s">"center"</span>, <span class="pl-s1">va</span><span class="pl-c1">=</span><span class="pl-s">"center"</span>, <span class="pl-s1">color</span><span class="pl-c1">=</span><span class="pl-s">"w"</span>)

<span class="pl-s1">ax</span>.<span class="pl-en">set_title</span>(<span class="pl-s">"Harvest of local farmers (in tons/year)"</span>)
<span class="pl-s1">fig</span>.<span class="pl-en">tight_layout</span>()
<span class="pl-s1">plt</span>.<span class="pl-en">show</span>()</pre></div>
<p dir="auto"><strong>Actual outcome</strong></p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/24250824/64229597-84f79d00-ceea-11e9-99f1-0c14b4ec3603.png"><img src="https://user-images.githubusercontent.com/24250824/64229597-84f79d00-ceea-11e9-99f1-0c14b4ec3603.png" alt="heatmap_3-1-1" style="max-width: 100%;"></a><br>
Copied from:<br>
<a href="https://matplotlib.org/3.1.1/gallery/images_contours_and_fields/image_annotated_heatmap.html#sphx-glr-gallery-images-contours-and-fields-image-annotated-heatmap-py" rel="nofollow">https://matplotlib.org/3.1.1/gallery/images_contours_and_fields/image_annotated_heatmap.html#sphx-glr-gallery-images-contours-and-fields-image-annotated-heatmap-py</a></p>
<p dir="auto"><strong>Expected outcome</strong></p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/24250824/64229624-917bf580-ceea-11e9-9810-c2b46bd27ad7.png"><img src="https://user-images.githubusercontent.com/24250824/64229624-917bf580-ceea-11e9-9810-c2b46bd27ad7.png" alt="heatmap_3-1-0" style="max-width: 100%;"></a><br>
Copied from:<br>
<a href="https://matplotlib.org/3.1.0/gallery/images_contours_and_fields/image_annotated_heatmap.html#sphx-glr-gallery-images-contours-and-fields-image-annotated-heatmap-py" rel="nofollow">https://matplotlib.org/3.1.0/gallery/images_contours_and_fields/image_annotated_heatmap.html#sphx-glr-gallery-images-contours-and-fields-image-annotated-heatmap-py</a></p>
<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>Operating system: Windows 8.1 and Ubuntu 18.04</li>
<li>Matplotlib version: 3.1.1</li>
<li>Matplotlib backend: Qt5Agg</li>
<li>Python version: 3.7.4 on Windows and 3.6.8 on Ubuntu</li>
</ul>
<p dir="auto">I am using conda on Windows and pip on Ubuntu.</p>
<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">The very top and bottom of the heatmaps are getting truncated to 1/2 height in version <code class="notranslate">3.1.1</code>. This does not happen for version <code class="notranslate">3.0.3</code>.</p>
<p dir="auto">This is the code from a Jupyter Notebook</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import matplotlib
import pandas as pd
import numpy as np
import seaborn as sb
%pylab inline

print(matplotlib.__version__)
print(sb.__version__)

grid = pd.DataFrame(np.arange(9).reshape((3,3))/10)
fig, ax = subplots(1, 1, figsize=(5, 5))

sb.heatmap(grid, annot=True, fmt=&quot;.0f&quot;, ax=ax, cmap='RdBu',  vmin=0, vmax=1, cbar=True);"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>
<span class="pl-k">import</span> <span class="pl-s1">pandas</span> <span class="pl-k">as</span> <span class="pl-s1">pd</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">import</span> <span class="pl-s1">seaborn</span> <span class="pl-k">as</span> <span class="pl-s1">sb</span>
<span class="pl-c1">%</span><span class="pl-s1">pylab</span> <span class="pl-s1">inline</span>

<span class="pl-en">print</span>(<span class="pl-s1">matplotlib</span>.<span class="pl-s1">__version__</span>)
<span class="pl-en">print</span>(<span class="pl-s1">sb</span>.<span class="pl-s1">__version__</span>)

<span class="pl-s1">grid</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>(<span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">9</span>).<span class="pl-en">reshape</span>((<span class="pl-c1">3</span>,<span class="pl-c1">3</span>))<span class="pl-c1">/</span><span class="pl-c1">10</span>)
<span class="pl-s1">fig</span>, <span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-en">subplots</span>(<span class="pl-c1">1</span>, <span class="pl-c1">1</span>, <span class="pl-s1">figsize</span><span class="pl-c1">=</span>(<span class="pl-c1">5</span>, <span class="pl-c1">5</span>))

<span class="pl-s1">sb</span>.<span class="pl-en">heatmap</span>(<span class="pl-s1">grid</span>, <span class="pl-s1">annot</span><span class="pl-c1">=</span><span class="pl-c1">True</span>, <span class="pl-s1">fmt</span><span class="pl-c1">=</span><span class="pl-s">".0f"</span>, <span class="pl-s1">ax</span><span class="pl-c1">=</span><span class="pl-s1">ax</span>, <span class="pl-s1">cmap</span><span class="pl-c1">=</span><span class="pl-s">'RdBu'</span>,  <span class="pl-s1">vmin</span><span class="pl-c1">=</span><span class="pl-c1">0</span>, <span class="pl-s1">vmax</span><span class="pl-c1">=</span><span class="pl-c1">1</span>, <span class="pl-s1">cbar</span><span class="pl-c1">=</span><span class="pl-c1">True</span>);</pre></div>
<p dir="auto"><strong>Actual outcome</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Populating the interactive namespace from numpy and matplotlib
3.1.1
0.9.0"><pre class="notranslate"><code class="notranslate">Populating the interactive namespace from numpy and matplotlib
3.1.1
0.9.0
</code></pre></div>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1696066/60530345-87f5c780-9cc6-11e9-9e31-a251283f3f7e.png"><img src="https://user-images.githubusercontent.com/1696066/60530345-87f5c780-9cc6-11e9-9e31-a251283f3f7e.png" alt="download" style="max-width: 100%;"></a></p>
<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>Operating system: Ubuntu Linux</li>
<li>Matplotlib version: 3.1.1</li>
<li>Matplotlib backend: module://ipykernel.pylab.backend_inline</li>
<li>Python version: 3.6</li>
<li>Jupyter version (if applicable): 4.4.0</li>
<li>Other libraries:</li>
</ul>