title: python matplotlib update scatter plot from a function
body: <p>I am trying to automatically update a scatter plot.
  The source of my X and Y values is external, and the data is pushed automatically into my code in a non-predicted time intervals (rounds). </p>
  
  <p>I have only managed to plot all the data when the whole process ended, whereas I am trying to constantly add and plot data into my canvas.</p>
  
  <p>What I DO get (at the end of the whole run) is this:
  <a href="https://i.stack.imgur.com/JeOMi.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/JeOMi.jpg" alt="enter image description here"></a></p>
  
  <p>Whereas, what I am after is this:
  <a href="https://i.stack.imgur.com/gXGZp.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/gXGZp.jpg" alt="enter image description here"></a></p>
  
  <p>A simplified version of my code:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  
  def read_data():
      #This function gets the values of xAxis and yAxis
      xAxis = [some values]  #these valuers change in each run
      yAxis = [other values] #these valuers change in each run
  
      plt.scatter(xAxis,yAxis, label  = 'myPlot', color = 'k', s=50)     
      plt.xlabel('x')
      plt.ylabel('y')
      plt.show()
  </code></pre>