<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">Interactive code (Jupyter Notebook using <code class="notranslate">%matplotlib notebook</code>) worked up to v3.2.x, stops working for v3.3.x. Tested on Firefox and Chrome.</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 ipywidgets as widgets
import matplotlib.pyplot as plt
from IPython.display import display

%matplotlib notebook

class MWE:

    def __init__(self):
        self.fig, self.ax = plt.subplots(1, 1)
        self.ax.set_xlim([-5, 105])
        self.ax.set_ylim([-500, 10500])
        self.create_widget()
        self.draw()

    def create_widget(self):
        value = widgets.interactive(
            self.update_value,
            value=widgets.IntSlider(value=50, min=0, max=100))
        display(value)

    def draw(self):
        self.ax.plot(self.value, self.value**2, 'o')

    def update_value(self, value):
        self.value = value
        self.draw()

MWE()"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">ipywidgets</span> <span class="pl-k">as</span> <span class="pl-s1">widgets</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">from</span> <span class="pl-v">IPython</span>.<span class="pl-s1">display</span> <span class="pl-k">import</span> <span class="pl-s1">display</span>

<span class="pl-c1">%</span><span class="pl-s1">matplotlib</span> <span class="pl-s1">notebook</span>

<span class="pl-k">class</span> <span class="pl-v">MWE</span>:

    <span class="pl-k">def</span> <span class="pl-en">__init__</span>(<span class="pl-s1">self</span>):
        <span class="pl-s1">self</span>.<span class="pl-s1">fig</span>, <span class="pl-s1">self</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-c1">1</span>, <span class="pl-c1">1</span>)
        <span class="pl-s1">self</span>.<span class="pl-s1">ax</span>.<span class="pl-en">set_xlim</span>([<span class="pl-c1">-</span><span class="pl-c1">5</span>, <span class="pl-c1">105</span>])
        <span class="pl-s1">self</span>.<span class="pl-s1">ax</span>.<span class="pl-en">set_ylim</span>([<span class="pl-c1">-</span><span class="pl-c1">500</span>, <span class="pl-c1">10500</span>])
        <span class="pl-s1">self</span>.<span class="pl-en">create_widget</span>()
        <span class="pl-s1">self</span>.<span class="pl-en">draw</span>()

    <span class="pl-k">def</span> <span class="pl-en">create_widget</span>(<span class="pl-s1">self</span>):
        <span class="pl-s1">value</span> <span class="pl-c1">=</span> <span class="pl-s1">widgets</span>.<span class="pl-en">interactive</span>(
            <span class="pl-s1">self</span>.<span class="pl-s1">update_value</span>,
            <span class="pl-s1">value</span><span class="pl-c1">=</span><span class="pl-s1">widgets</span>.<span class="pl-v">IntSlider</span>(<span class="pl-s1">value</span><span class="pl-c1">=</span><span class="pl-c1">50</span>, <span class="pl-s1">min</span><span class="pl-c1">=</span><span class="pl-c1">0</span>, <span class="pl-s1">max</span><span class="pl-c1">=</span><span class="pl-c1">100</span>))
        <span class="pl-en">display</span>(<span class="pl-s1">value</span>)

    <span class="pl-k">def</span> <span class="pl-en">draw</span>(<span class="pl-s1">self</span>):
        <span class="pl-s1">self</span>.<span class="pl-s1">ax</span>.<span class="pl-en">plot</span>(<span class="pl-s1">self</span>.<span class="pl-s1">value</span>, <span class="pl-s1">self</span>.<span class="pl-s1">value</span><span class="pl-c1">**</span><span class="pl-c1">2</span>, <span class="pl-s">'o'</span>)

    <span class="pl-k">def</span> <span class="pl-en">update_value</span>(<span class="pl-s1">self</span>, <span class="pl-s1">value</span>):
        <span class="pl-s1">self</span>.<span class="pl-s1">value</span> <span class="pl-c1">=</span> <span class="pl-s1">value</span>
        <span class="pl-s1">self</span>.<span class="pl-en">draw</span>()

<span class="pl-v">MWE</span>()</pre></div>
<p dir="auto"><strong>Actual outcome</strong><br>
Just an empty figure, moving the slider has no effect, no warning thrown either.</p>
<p dir="auto"><strong>Expected outcome</strong><br>
More and more dots should be printed when moving the slider.</p>
<p dir="auto"><strong>Matplotlib version</strong></p>
<ul dir="auto">
<li>Operating system: Ubuntu 20.04</li>
<li>Matplotlib version: &lt;3.2.x works, &gt;=3.3.2 does not.</li>
<li>Matplotlib backend: nbAgg</li>
<li>Python version: 3.8.6</li>
<li>Jupyter version (if applicable): 1.0.0</li>
<li>Other libraries: widgets v7.5.1</li>
</ul>
<p dir="auto">Installed with <code class="notranslate">mamba</code> from <code class="notranslate">conda-forge</code>.</p>
<p dir="auto">It might be related to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="701344817" data-permission-text="Title is private" data-url="https://github.com/matplotlib/matplotlib/issues/18481" data-hovercard-type="issue" data-hovercard-url="/matplotlib/matplotlib/issues/18481/hovercard" href="https://github.com/matplotlib/matplotlib/issues/18481">#18481</a>, but it happens for Firefox and Chrome on my machine. Also, the mentioned workaround (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="701344817" data-permission-text="Title is private" data-url="https://github.com/matplotlib/matplotlib/issues/18481" data-hovercard-type="issue" data-hovercard-url="/matplotlib/matplotlib/issues/18481/hovercard?comment_id=692337027&amp;comment_type=issue_comment" href="https://github.com/matplotlib/matplotlib/issues/18481#issuecomment-692337027">#18481 (comment)</a>) does not help.</p>
<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">Using <code class="notranslate">ipywidgets.interact</code> to update a figure works as expected in <code class="notranslate">matplotlib&lt;=3.3.1</code>, but fails in <code class="notranslate">matplotlib==3.3.2</code>.</p>
<p dir="auto">I don't think this is an <code class="notranslate">ipywidgets</code> issue since downgrading <code class="notranslate">matplotlib</code> fixes this issue.</p>
<p dir="auto"><strong>Code for reproduction</strong></p>
<p dir="auto">In[1]:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="%matplotlib notebook
import matplotlib as mpl
import matplotlib.pyplot as plt
import ipywidgets as ipyw
&quot;works if %s &lt;= 3.3.1&quot; % mpl.__version__"><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">matplotlib</span> <span class="pl-k">as</span> <span class="pl-s1">mpl</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">ipywidgets</span> <span class="pl-k">as</span> <span class="pl-s1">ipyw</span>
<span class="pl-s">"works if %s &lt;= 3.3.1"</span> <span class="pl-c1">%</span> <span class="pl-s1">mpl</span>.<span class="pl-s1">__version__</span></pre></div>
<p dir="auto">In[2]:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="fig = plt.figure()
@ipyw.interact(m=ipyw.FloatSlider(value=1, min=-10, max=10, step=0.01))
def update(m):
    plt.figure(fig.number, clear=True)
    plt.plot([m * x for x in range(-9, 10)])"><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-en">@<span class="pl-s1">ipyw</span>.<span class="pl-en">interact</span>(<span class="pl-s1">m</span><span class="pl-c1">=</span><span class="pl-s1">ipyw</span>.<span class="pl-v">FloatSlider</span>(<span class="pl-s1">value</span><span class="pl-c1">=</span><span class="pl-c1">1</span>, <span class="pl-s1">min</span><span class="pl-c1">=</span><span class="pl-c1">-</span><span class="pl-c1">10</span>, <span class="pl-s1">max</span><span class="pl-c1">=</span><span class="pl-c1">10</span>, <span class="pl-s1">step</span><span class="pl-c1">=</span><span class="pl-c1">0.01</span>))</span>
<span class="pl-k">def</span> <span class="pl-en">update</span>(<span class="pl-s1">m</span>):
    <span class="pl-s1">plt</span>.<span class="pl-en">figure</span>(<span class="pl-s1">fig</span>.<span class="pl-s1">number</span>, <span class="pl-s1">clear</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)
    <span class="pl-s1">plt</span>.<span class="pl-en">plot</span>([<span class="pl-s1">m</span> <span class="pl-c1">*</span> <span class="pl-s1">x</span> <span class="pl-k">for</span> <span class="pl-s1">x</span> <span class="pl-c1">in</span> <span class="pl-en">range</span>(<span class="pl-c1">-</span><span class="pl-c1">9</span>, <span class="pl-c1">10</span>)])</pre></div>
<p dir="auto">Followed by moving the slider.</p>
<p dir="auto"><strong>Actual outcome</strong></p>
<ul dir="auto">
<li>when moving the slider, the figure does not update</li>
<li>a second figure is sometimes created instead</li>
<li>the second figure is usually blank, but sometimes updates instead</li>
</ul>
<p dir="auto"><strong>Expected outcome</strong></p>
<ul dir="auto">
<li>the original figure updates as it does in <code class="notranslate">matplotlib==3.3.1</code></li>
</ul>
<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>Operating system: Ubuntu</li>
<li>Matplotlib version: 3.3.2 vs 3.3.1</li>
<li>Matplotlib backend (<code class="notranslate">print(matplotlib.get_backend())</code>): nbAgg</li>
<li>Python version: 3.7.8</li>
<li>Jupyter version (if applicable): jupyter-core==4.6.3</li>
<li>Other libraries: ipywidgets==7.5.1</li>
<li>Installation source: <code class="notranslate">conda</code> channel <code class="notranslate">conda-forge</code></li>
</ul>