title: Dynamically updating plot (Funcanimation) in matplotlib
body: <p>I am trying to do a dynamically updating plot in Matplotlib Python 3.x using Tkinter.
  It starts with displaying a file dialog for the user to select the .csv file.</p>
  <p>Here's the example of the .csv file:
  <a href="https://i.stack.imgur.com/ZXRio.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZXRio.png" alt="sample CSV File" /></a></p>
  <p>I want to plot each row then the plot is updated &amp; plotting the next row.</p>
  <p>Here's what I currently have:</p>
  <pre><code>plt.style.use('fivethirtyeight')
  
  xs =[]
  ys = []
  
  csvFile = filedialog.askopenfile(mode='r', filetypes=((&quot;CSV file&quot;, &quot;*.csv&quot;), (&quot;All files&quot;, &quot;*.*&quot;)), title=&quot;Select a  CSV file&quot;)
  csvFile2 = pd.read_csv(csvFile, header=[2])
  
  selectedColumn = csvFile2.iloc[0:, 3:]
  
  selectedArray = selectedColumn.to_numpy()  # arrays
  
  
  def animate():
      for row in selectedArray:
          plt.clf() #clear current figure
          plt.plot(row)
          plt.title('Plot')
          plt.xlabel('Radar No')
          plt.ylabel('Value')
  
          plt.ylim(0.2, 0.9)  # Keeping the y axis stays the same during the loop
          plt.draw()
          plt.pause(0.0078) #0.0078 if the frequency is 128Hz -- Idk about this one
          plt.show()
  animate()
  </code></pre>
  <p>It does plot the numbers dynamically, but the fps is so slow, about 5 fps.</p>
  <p>Therefore, I am looking for another method, Funcanimation, but I am not sure how to use it.
  Inside the variable <strong>Selectedarray</strong> is something like this:</p>
  <blockquote>
  <p>[0.489377 0.481563 0.477656 ... 0.300366 0.294261 0.288156]
  [0.489866 0.48254  0.478633 ... 0.300855 0.294994 0.288645]
  [0.489377 0.481319 0.478144 ... 0.300122 0.293773 0.288156]</p>
  </blockquote>
  <p>....</p>
  <p>I believe using Funcanimation is faster and I could control the speed(?) Could anyone pls help.</p>
  <p>Thank you.</p>