title: Jupyter: Triggering an output when clicking on a point in a scatterplot which replaces previous outputs (rather than being appended)
body: <p>I'm trying to build an interactive scatter plot in Jupyter, where clicking on a point will trigger plotting another (non interactive) Seaborn plot based on the point clicked. Iv'e managed to do this using plotly (This is a toy example)</p>
  
  <pre><code>import plotly.graph_objects as go
  import matplotlib.pyplot as plt
  import seaborn as sns; sns.set()
  import numpy as np
  %matplotlib inline
  
  x = np.arange(10)
  f = go.FigureWidget([go.Scatter(x=x, y=2*x)])
  
  scatter = f.data[0]
  f.layout.hovermode = 'closest'
  
  # create our callback function
  def click_callback(trace, points, selector):
      sns.lineplot(np.arange(10), [points.ys[0]]*10)
      plt.show()
  
  scatter.on_click(click_callback)
  
  f
  </code></pre>
  
  <p>The problem is that each new Seaborn plot is appended to the cell while I want it to replace the previous one. If I try to use IPython.display.clear_output(), the original plotly scatterplot is erased too. How can I clear only the Seaborn plot before plotting a new one?</p>
  
  <p>Also, if there is a easy to implement superior solution for the general task (Triggering a new plot when clicking on a point in the scatter plot), I'd like to know</p>
  
  <p>Thanks!</p>