<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">Starting in matplotlib 3.1.1, the outer cells of the <code class="notranslate">mathshow</code> (and <code class="notranslate">imshow</code>) functions cut cells off by half.</p>
<p dir="auto">Before (matplotlib &lt;= 3.1.0):</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/5618407/69210413-53bd5f00-0b20-11ea-9a53-aa34d13e7b6c.png"><img src="https://user-images.githubusercontent.com/5618407/69210413-53bd5f00-0b20-11ea-9a53-aa34d13e7b6c.png" alt="Screen Shot 2019-11-19 at 10 59 53 PM" style="max-width: 100%;"></a></p>
<p dir="auto">After (matplotlib == 3.1.1:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/5618407/69210659-17d6c980-0b21-11ea-8ed6-3be67a2c134e.png"><img src="https://user-images.githubusercontent.com/5618407/69210659-17d6c980-0b21-11ea-8ed6-3be67a2c134e.png" alt="Screen Shot 2019-11-19 at 11 05 28 PM" style="max-width: 100%;"></a></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 pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#from mlxtend.plotting import heatmap



df = pd.read_csv('https://raw.githubusercontent.com/rasbt/'
                 'python-machine-learning-book-2nd-edition'
                 '/master/code/ch10/housing.data.txt',
                 header=None,
                 sep='\s+')

df.columns = ['CRIM', 'ZN', 'INDUS', 'CHAS', 
              'NOX', 'RM', 'AGE', 'DIS', 'RAD', 
              'TAX', 'PTRATIO', 'B', 'LSTAT', 'MEDV']

cols = ['LSTAT', 'INDUS', 'NOX', 'RM', 'MEDV']




import matplotlib.pyplot as plt
import numpy as np


def heatmap(matrix,
            hide_spines=False,
            hide_ticks=False,
            figsize=None,
            cmap=None,
            colorbar=True,
            row_names=None,
            column_names=None,
            column_name_rotation=45,
            cell_fmt='.2f',
            cell_font_size=None):
    &quot;&quot;&quot;Plot a heatmap via matplotlib.

    Parameters
    -----------
    conf_mat : array-like, shape = [n_rows, n_columns]
        And arbitrary 2D array.

    hide_spines : bool (default: False)
        Hides axis spines if True.

    hide_ticks : bool (default: False)
        Hides axis ticks if True

    figsize : tuple (default: (2.5, 2.5))
        Height and width of the figure

    cmap : matplotlib colormap (default: `None`)
        Uses matplotlib.pyplot.cm.viridis if `None`

    colorbar : bool (default: True)
        Shows a colorbar if True

    row_names : array-like, shape = [n_rows] (default: None)
        List of row names to be used as y-axis tick labels.

    column_names : array-like, shape = [n_columns] (default: None)
        List of column names to be used as x-axis tick labels.

    column_name_rotation : int (default: 45)
        Number of degrees for rotating column x-tick labels.

    cell_fmt : string (default: '.2f')
        Format specification for cell values.

    cell_font_size : int (default: None)
        Font size for cell values

    Returns
    -----------
    fig, ax : matplotlib.pyplot subplot objects
        Figure and axis elements of the subplot.

    Examples
    -----------
    For usage examples, please see
    http://rasbt.github.io/mlxtend/user_guide/plotting/heatmap/

    &quot;&quot;&quot;

    if row_names is not None and len(row_names) != matrix.shape[0]:
        raise AssertionError(f'len(row_names) (got {len(row_names)})'
                             ' should be equal to number of'
                             ' rows in the input '
                             f' array (expect {matrix.shape[0]}).')

    if column_names is not None and len(column_names) != matrix.shape[1]:
        raise AssertionError(f'len(column_names)'
                             ' (got {len(column_names)})'
                             ' should be equal to number of'
                             ' columns in the'
                             f' input array (expect {matrix.shape[1]}).')

    fig, ax = plt.subplots(figsize=figsize)
    ax.grid(False)

    if cmap is None:
        cmap = plt.cm.viridis

    if figsize is None:
        figsize = (len(matrix)*1.25, len(matrix)*1.25)

    matshow = ax.matshow(matrix, cmap=cmap)

    if colorbar:
        fig.colorbar(matshow)

    normed_matrix = matrix.astype('float') / matrix.max()

    for i in range(matrix.shape[0]):
        for j in range(matrix.shape[1]):
            cell_text = format(matrix[i, j], cell_fmt)

            ax.text(x=j,
                    y=i,
                    size=cell_font_size,
                    s=cell_text,
                    va='center',
                    ha='center',
                    color=&quot;white&quot; if normed_matrix[i, j] &lt; 0.5 else &quot;black&quot;)

    if row_names is not None:
        tick_marks = np.arange(len(row_names))
        plt.yticks(tick_marks, row_names)

    if column_names is not None:
        tick_marks = np.arange(len(column_names))
        plt.xticks(tick_marks, column_names, rotation=column_name_rotation)

    if hide_spines:
        ax.spines['right'].set_visible(False)
        ax.spines['top'].set_visible(False)
        ax.spines['left'].set_visible(False)
        ax.spines['bottom'].set_visible(False)
    ax.yaxis.set_ticks_position('left')
    ax.xaxis.set_ticks_position('bottom')
    if hide_ticks:
        ax.axes.get_yaxis().set_ticks([])
        ax.axes.get_xaxis().set_ticks([])

    return fig, ax


cm = np.corrcoef(df[cols].values.T)
hm = heatmap(cm, row_names=cols, column_names=cols)


plt.tight_layout()
plt.show()"><pre class="notranslate"><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">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>
<span class="pl-c">#from mlxtend.plotting import heatmap</span>



<span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-en">read_csv</span>(<span class="pl-s">'https://raw.githubusercontent.com/rasbt/'</span>
                 <span class="pl-s">'python-machine-learning-book-2nd-edition'</span>
                 <span class="pl-s">'/master/code/ch10/housing.data.txt'</span>,
                 <span class="pl-s1">header</span><span class="pl-c1">=</span><span class="pl-c1">None</span>,
                 <span class="pl-s1">sep</span><span class="pl-c1">=</span><span class="pl-s">'\s+'</span>)

<span class="pl-s1">df</span>.<span class="pl-s1">columns</span> <span class="pl-c1">=</span> [<span class="pl-s">'CRIM'</span>, <span class="pl-s">'ZN'</span>, <span class="pl-s">'INDUS'</span>, <span class="pl-s">'CHAS'</span>, 
              <span class="pl-s">'NOX'</span>, <span class="pl-s">'RM'</span>, <span class="pl-s">'AGE'</span>, <span class="pl-s">'DIS'</span>, <span class="pl-s">'RAD'</span>, 
              <span class="pl-s">'TAX'</span>, <span class="pl-s">'PTRATIO'</span>, <span class="pl-s">'B'</span>, <span class="pl-s">'LSTAT'</span>, <span class="pl-s">'MEDV'</span>]

<span class="pl-s1">cols</span> <span class="pl-c1">=</span> [<span class="pl-s">'LSTAT'</span>, <span class="pl-s">'INDUS'</span>, <span class="pl-s">'NOX'</span>, <span class="pl-s">'RM'</span>, <span class="pl-s">'MEDV'</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-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">def</span> <span class="pl-en">heatmap</span>(<span class="pl-s1">matrix</span>,
            <span class="pl-s1">hide_spines</span><span class="pl-c1">=</span><span class="pl-c1">False</span>,
            <span class="pl-s1">hide_ticks</span><span class="pl-c1">=</span><span class="pl-c1">False</span>,
            <span class="pl-s1">figsize</span><span class="pl-c1">=</span><span class="pl-c1">None</span>,
            <span class="pl-s1">cmap</span><span class="pl-c1">=</span><span class="pl-c1">None</span>,
            <span class="pl-s1">colorbar</span><span class="pl-c1">=</span><span class="pl-c1">True</span>,
            <span class="pl-s1">row_names</span><span class="pl-c1">=</span><span class="pl-c1">None</span>,
            <span class="pl-s1">column_names</span><span class="pl-c1">=</span><span class="pl-c1">None</span>,
            <span class="pl-s1">column_name_rotation</span><span class="pl-c1">=</span><span class="pl-c1">45</span>,
            <span class="pl-s1">cell_fmt</span><span class="pl-c1">=</span><span class="pl-s">'.2f'</span>,
            <span class="pl-s1">cell_font_size</span><span class="pl-c1">=</span><span class="pl-c1">None</span>):
    <span class="pl-s">"""Plot a heatmap via matplotlib.</span>
<span class="pl-s"></span>
<span class="pl-s">    Parameters</span>
<span class="pl-s">    -----------</span>
<span class="pl-s">    conf_mat : array-like, shape = [n_rows, n_columns]</span>
<span class="pl-s">        And arbitrary 2D array.</span>
<span class="pl-s"></span>
<span class="pl-s">    hide_spines : bool (default: False)</span>
<span class="pl-s">        Hides axis spines if True.</span>
<span class="pl-s"></span>
<span class="pl-s">    hide_ticks : bool (default: False)</span>
<span class="pl-s">        Hides axis ticks if True</span>
<span class="pl-s"></span>
<span class="pl-s">    figsize : tuple (default: (2.5, 2.5))</span>
<span class="pl-s">        Height and width of the figure</span>
<span class="pl-s"></span>
<span class="pl-s">    cmap : matplotlib colormap (default: `None`)</span>
<span class="pl-s">        Uses matplotlib.pyplot.cm.viridis if `None`</span>
<span class="pl-s"></span>
<span class="pl-s">    colorbar : bool (default: True)</span>
<span class="pl-s">        Shows a colorbar if True</span>
<span class="pl-s"></span>
<span class="pl-s">    row_names : array-like, shape = [n_rows] (default: None)</span>
<span class="pl-s">        List of row names to be used as y-axis tick labels.</span>
<span class="pl-s"></span>
<span class="pl-s">    column_names : array-like, shape = [n_columns] (default: None)</span>
<span class="pl-s">        List of column names to be used as x-axis tick labels.</span>
<span class="pl-s"></span>
<span class="pl-s">    column_name_rotation : int (default: 45)</span>
<span class="pl-s">        Number of degrees for rotating column x-tick labels.</span>
<span class="pl-s"></span>
<span class="pl-s">    cell_fmt : string (default: '.2f')</span>
<span class="pl-s">        Format specification for cell values.</span>
<span class="pl-s"></span>
<span class="pl-s">    cell_font_size : int (default: None)</span>
<span class="pl-s">        Font size for cell values</span>
<span class="pl-s"></span>
<span class="pl-s">    Returns</span>
<span class="pl-s">    -----------</span>
<span class="pl-s">    fig, ax : matplotlib.pyplot subplot objects</span>
<span class="pl-s">        Figure and axis elements of the subplot.</span>
<span class="pl-s"></span>
<span class="pl-s">    Examples</span>
<span class="pl-s">    -----------</span>
<span class="pl-s">    For usage examples, please see</span>
<span class="pl-s">    http://rasbt.github.io/mlxtend/user_guide/plotting/heatmap/</span>
<span class="pl-s"></span>
<span class="pl-s">    """</span>

    <span class="pl-k">if</span> <span class="pl-s1">row_names</span> <span class="pl-c1">is</span> <span class="pl-c1">not</span> <span class="pl-c1">None</span> <span class="pl-c1">and</span> <span class="pl-en">len</span>(<span class="pl-s1">row_names</span>) <span class="pl-c1">!=</span> <span class="pl-s1">matrix</span>.<span class="pl-s1">shape</span>[<span class="pl-c1">0</span>]:
        <span class="pl-k">raise</span> <span class="pl-v">AssertionError</span>(<span class="pl-s">f'len(row_names) (got <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-en">len</span>(<span class="pl-s1">row_names</span>)<span class="pl-kos">}</span></span>)'</span>
                             <span class="pl-s">' should be equal to number of'</span>
                             <span class="pl-s">' rows in the input '</span>
                             <span class="pl-s">f' array (expect <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">matrix</span>.<span class="pl-s1">shape</span>[<span class="pl-c1">0</span>]<span class="pl-kos">}</span></span>).'</span>)

    <span class="pl-k">if</span> <span class="pl-s1">column_names</span> <span class="pl-c1">is</span> <span class="pl-c1">not</span> <span class="pl-c1">None</span> <span class="pl-c1">and</span> <span class="pl-en">len</span>(<span class="pl-s1">column_names</span>) <span class="pl-c1">!=</span> <span class="pl-s1">matrix</span>.<span class="pl-s1">shape</span>[<span class="pl-c1">1</span>]:
        <span class="pl-k">raise</span> <span class="pl-v">AssertionError</span>(<span class="pl-s">f'len(column_names)'</span>
                             <span class="pl-s">' (got {len(column_names)})'</span>
                             <span class="pl-s">' should be equal to number of'</span>
                             <span class="pl-s">' columns in the'</span>
                             <span class="pl-s">f' input array (expect <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">matrix</span>.<span class="pl-s1">shape</span>[<span class="pl-c1">1</span>]<span class="pl-kos">}</span></span>).'</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">figsize</span><span class="pl-c1">=</span><span class="pl-s1">figsize</span>)
    <span class="pl-s1">ax</span>.<span class="pl-en">grid</span>(<span class="pl-c1">False</span>)

    <span class="pl-k">if</span> <span class="pl-s1">cmap</span> <span class="pl-c1">is</span> <span class="pl-c1">None</span>:
        <span class="pl-s1">cmap</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-s1">cm</span>.<span class="pl-s1">viridis</span>

    <span class="pl-k">if</span> <span class="pl-s1">figsize</span> <span class="pl-c1">is</span> <span class="pl-c1">None</span>:
        <span class="pl-s1">figsize</span> <span class="pl-c1">=</span> (<span class="pl-en">len</span>(<span class="pl-s1">matrix</span>)<span class="pl-c1">*</span><span class="pl-c1">1.25</span>, <span class="pl-en">len</span>(<span class="pl-s1">matrix</span>)<span class="pl-c1">*</span><span class="pl-c1">1.25</span>)

    <span class="pl-s1">matshow</span> <span class="pl-c1">=</span> <span class="pl-s1">ax</span>.<span class="pl-en">matshow</span>(<span class="pl-s1">matrix</span>, <span class="pl-s1">cmap</span><span class="pl-c1">=</span><span class="pl-s1">cmap</span>)

    <span class="pl-k">if</span> <span class="pl-s1">colorbar</span>:
        <span class="pl-s1">fig</span>.<span class="pl-en">colorbar</span>(<span class="pl-s1">matshow</span>)

    <span class="pl-s1">normed_matrix</span> <span class="pl-c1">=</span> <span class="pl-s1">matrix</span>.<span class="pl-en">astype</span>(<span class="pl-s">'float'</span>) <span class="pl-c1">/</span> <span class="pl-s1">matrix</span>.<span class="pl-en">max</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-s1">matrix</span>.<span class="pl-s1">shape</span>[<span class="pl-c1">0</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-s1">matrix</span>.<span class="pl-s1">shape</span>[<span class="pl-c1">1</span>]):
            <span class="pl-s1">cell_text</span> <span class="pl-c1">=</span> <span class="pl-en">format</span>(<span class="pl-s1">matrix</span>[<span class="pl-s1">i</span>, <span class="pl-s1">j</span>], <span class="pl-s1">cell_fmt</span>)

            <span class="pl-s1">ax</span>.<span class="pl-en">text</span>(<span class="pl-s1">x</span><span class="pl-c1">=</span><span class="pl-s1">j</span>,
                    <span class="pl-s1">y</span><span class="pl-c1">=</span><span class="pl-s1">i</span>,
                    <span class="pl-s1">size</span><span class="pl-c1">=</span><span class="pl-s1">cell_font_size</span>,
                    <span class="pl-s1">s</span><span class="pl-c1">=</span><span class="pl-s1">cell_text</span>,
                    <span class="pl-s1">va</span><span class="pl-c1">=</span><span class="pl-s">'center'</span>,
                    <span class="pl-s1">ha</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">"white"</span> <span class="pl-k">if</span> <span class="pl-s1">normed_matrix</span>[<span class="pl-s1">i</span>, <span class="pl-s1">j</span>] <span class="pl-c1">&lt;</span> <span class="pl-c1">0.5</span> <span class="pl-k">else</span> <span class="pl-s">"black"</span>)

    <span class="pl-k">if</span> <span class="pl-s1">row_names</span> <span class="pl-c1">is</span> <span class="pl-c1">not</span> <span class="pl-c1">None</span>:
        <span class="pl-s1">tick_marks</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-en">len</span>(<span class="pl-s1">row_names</span>))
        <span class="pl-s1">plt</span>.<span class="pl-en">yticks</span>(<span class="pl-s1">tick_marks</span>, <span class="pl-s1">row_names</span>)

    <span class="pl-k">if</span> <span class="pl-s1">column_names</span> <span class="pl-c1">is</span> <span class="pl-c1">not</span> <span class="pl-c1">None</span>:
        <span class="pl-s1">tick_marks</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-en">len</span>(<span class="pl-s1">column_names</span>))
        <span class="pl-s1">plt</span>.<span class="pl-en">xticks</span>(<span class="pl-s1">tick_marks</span>, <span class="pl-s1">column_names</span>, <span class="pl-s1">rotation</span><span class="pl-c1">=</span><span class="pl-s1">column_name_rotation</span>)

    <span class="pl-k">if</span> <span class="pl-s1">hide_spines</span>:
        <span class="pl-s1">ax</span>.<span class="pl-s1">spines</span>[<span class="pl-s">'right'</span>].<span class="pl-en">set_visible</span>(<span class="pl-c1">False</span>)
        <span class="pl-s1">ax</span>.<span class="pl-s1">spines</span>[<span class="pl-s">'top'</span>].<span class="pl-en">set_visible</span>(<span class="pl-c1">False</span>)
        <span class="pl-s1">ax</span>.<span class="pl-s1">spines</span>[<span class="pl-s">'left'</span>].<span class="pl-en">set_visible</span>(<span class="pl-c1">False</span>)
        <span class="pl-s1">ax</span>.<span class="pl-s1">spines</span>[<span class="pl-s">'bottom'</span>].<span class="pl-en">set_visible</span>(<span class="pl-c1">False</span>)
    <span class="pl-s1">ax</span>.<span class="pl-s1">yaxis</span>.<span class="pl-en">set_ticks_position</span>(<span class="pl-s">'left'</span>)
    <span class="pl-s1">ax</span>.<span class="pl-s1">xaxis</span>.<span class="pl-en">set_ticks_position</span>(<span class="pl-s">'bottom'</span>)
    <span class="pl-k">if</span> <span class="pl-s1">hide_ticks</span>:
        <span class="pl-s1">ax</span>.<span class="pl-s1">axes</span>.<span class="pl-en">get_yaxis</span>().<span class="pl-en">set_ticks</span>([])
        <span class="pl-s1">ax</span>.<span class="pl-s1">axes</span>.<span class="pl-en">get_xaxis</span>().<span class="pl-en">set_ticks</span>([])

    <span class="pl-k">return</span> <span class="pl-s1">fig</span>, <span class="pl-s1">ax</span>


<span class="pl-s1">cm</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">corrcoef</span>(<span class="pl-s1">df</span>[<span class="pl-s1">cols</span>].<span class="pl-s1">values</span>.<span class="pl-v">T</span>)
<span class="pl-s1">hm</span> <span class="pl-c1">=</span> <span class="pl-en">heatmap</span>(<span class="pl-s1">cm</span>, <span class="pl-s1">row_names</span><span class="pl-c1">=</span><span class="pl-s1">cols</span>, <span class="pl-s1">column_names</span><span class="pl-c1">=</span><span class="pl-s1">cols</span>)


<span class="pl-s1">plt</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/5618407/69210659-17d6c980-0b21-11ea-8ed6-3be67a2c134e.png"><img src="https://user-images.githubusercontent.com/5618407/69210659-17d6c980-0b21-11ea-8ed6-3be67a2c134e.png" alt="Screen Shot 2019-11-19 at 11 05 28 PM" style="max-width: 100%;"></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/5618407/69210461-6fc10080-0b20-11ea-96cf-9db0e75a117c.png"><img src="https://user-images.githubusercontent.com/5618407/69210461-6fc10080-0b20-11ea-96cf-9db0e75a117c.png" alt="Screen Shot 2019-11-19 at 10 59 53 PM" style="max-width: 100%;"></a></p>
<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>Operating system: macOS 10.15.1</li>
<li>Matplotlib version: 3.1.1</li>
<li>Matplotlib backend (<code class="notranslate">print(matplotlib.get_backend())</code>):module://ipykernel.pylab.backend_inline</li>
<li>Python version: 3.7</li>
<li>Jupyter version (if applicable): 1.1.4</li>
<li>Other libraries:</li>
</ul>

<p dir="auto">Installed matplotlib via   <code class="notranslate">conda install matplotlib</code></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>