title: How can I make two independent interactive cells in a jupyter notebook display using Voila?
body: <p>I'd like to make an interactive jupyter notebook with two different, independent plots. I'd also like to make this notebook easy for my colleagues to access and run, thus Voila. The closest I've gotten to making this work looks like this:</p>
  <p>Cell 1:</p>
  <pre><code>import ipywidgets
  import matplotlib.pyplot as plt
  %matplotlib widget
  </code></pre>
  <p>Cell 2:</p>
  <pre><code>fig, ax = plt.subplots(figsize = (9.5,5))
  
  def plot_figure_1(slider_val):
      ax.clear()
      xs = list(range(slider_val))
      ax.plot(xs, [x**2 for x in xs])
      plt.show()
      
  interactive_plot_1 = ipywidgets.interactive(plot_figure_1, 
                          slider_val = ipywidgets.IntSlider(value=100, min=10, max=200, 
                                                            description = &quot;A slider&quot;,
                                                            continuous_update = False))
  display(interactive_plot_1)
  </code></pre>
  <p>Cell 3:</p>
  <pre><code>fig2, ax2 = plt.subplots(figsize = (9.5,5))
  
  def plot_figure_2(slider_val):
      ax2.clear()
      xs2 = list(range(slider_val))
      ax2.plot(xs2, [x**2 for x in xs2])
      plt.show()
      
  interactive_plot_2 = ipywidgets.interactive(plot_figure_2, 
                          slider_val = ipywidgets.IntSlider(value=100, min=10, max=200, 
                                                            description = &quot;A slider&quot;,
                                                            continuous_update = False))
  display(interactive_plot_2)
  </code></pre>
  <p>This works fine in a jupyter notebook, but when I convert it to a live notebook with Voila, I get two problems:</p>
  <ol>
  <li><p>(the major problem) The two cells are no longer independent -- both cells update whenever I move either slider, and both cells update <em>according to the second slider</em>.</p>
  </li>
  <li><p>(a minor problem) Neither plot appears on screen until I interact with the corresponding widget.</p>
  </li>
  </ol>
  <p>I think this problem has something to do with using <code>plt.show()</code> to display, but if I comment out <code>plt.show()</code> then both plots disappear from the Voila-ed version. If I replace <code>plt.show()</code> with <code>fig.canvas.draw()</code> (and <code>fig2.canvas.draw()</code>), then both plots fail to display in both the notebook version <em>and</em> the Voila version.</p>
  <p>How can I get both plots to display and work interactively (and independently) in an easy-to-access way?</p>
  <p>Relevant versions:</p>
  <ul>
  <li>OSX 10.15.7</li>
  <li>Python 3.9.5</li>
  <li>Matplotlib 3.4.2</li>
  <li>Ipywidgets 7.6.5</li>
  <li>IPython 7.27.0</li>
  <li>Jupyterlab 3.2.4</li>
  <li>Voila 0.2.16</li>
  </ul>