title: Matplotlib FuncAnimation not working in windowed application using PyQT5
body: <p>I have a windowed application that, when a button is pressed, is supposed to trigger an animation of a 3d scatter plot using matplotlib. Here's my code:</p>
  
  <pre class="lang-py prettyprint-override"><code>from __future__ import print_function
  from PyQt5.QtWidgets import QApplication, QLabel, QVBoxLayout, QWidget, QListWidget, QPushButton, QMainWindow
  from PyQt5.QtCore import QObject
  from matplotlib.animation import FuncAnimation
  from matplotlib import pyplot as plt
  
  import platform
  import sys
  import six
  import numpy as np
  import mpl_toolkits.mplot3d.axes3d as p3
  
  i = 1
  
  def main():
      global device_app, device_listbox, device_win_conf_button, device_win
      device_app = QApplication(sys.argv)     # Initialize QApp
      device_win = QWidget()
  
  
      device_win_layout = QVBoxLayout()    # Layout
  
      device_win_conf_button = QPushButton("Proceed")
  
      device_app.aboutToQuit.connect(quit)
  
      device_win_conf_button.clicked.connect(plotAnimator)
  
      device_win_layout.addWidget(device_win_conf_button)
      device_win.setLayout(device_win_layout) # Assign layout to window and resize
      device_win.resize(500, 500)
  
      device_win.show()
      device_app.exec_()  # Enter loop
  
  def plotAnimator():
      global sc_plot, x, y, z
      fig = plt.figure()  # Create matplotlib fig
  
      ax = fig.add_subplot(111, projection='3d')  # Add plot
      ax.set_title("Example")
      ax.set_xlim3d(-10, 10) # Set bounds
      ax.set_ylim3d(-10, 10)
      ax.set_zlim3d(-10, 10)
  
      x = [0]
      y = [0]
      z = [0]
      sc_plot = ax.scatter(x,y,z) # Start at 0, 0, 0
      print(2)
      animation = FuncAnimation(fig, updatePlot, frames=2, interval=100)
  
      plt.show()
  
  def updatePlot(frame):
      global i
  
      x.append(i)
      y.append(i)
      z.append(i)
      sc_plot._offsets3d = (x, y, z)
      i += 1
  
  main()
  </code></pre>
  
  <p>So when I run this and click the button, the scatter plot shows up with the single point I've initialized it with at (0, 0, 0). I can interact with the plot, rotating it around and zooming in and out, yet there's no animation. Further, the following is printed to the console when I click the "Proceed" button:
  <code>QCoreApplication::exec: The event loop is already running</code>. </p>
  
  <p>I've researched this error and from what I understand it comes from trying to execute a <code>QApplication</code> that's already being executed. I don't see that happening in my code. The only thing I can think of is that maybe matplotlib uses PyQT to create its windows? Even if that was the case, though, I'm having trouble thinking about how I would fix it.</p>
  
  <p>Any help is greatly appreciated, thanks!</p>