title: animared plot two different colors and shapes in 3d in matplotlib python
body: <p>i try to animate two different classes "red dots" and "blue triangles". At the beginning they are all on the x-y plane and through the animation all of them should move along the z-axis. At the end it should look like on the picture.</p>
  
  <p><a href="https://i.stack.imgur.com/66OhN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/66OhN.png" alt="enter image description here"></a></p>
  
  <p>I reached what i want in two seperate figures</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import matplotlib.animation as animation
  import numpy as np
  from mpl_toolkits.mplot3d import Axes3D
  
  np.random.seed(19680801)
  n = 200
  breite=20
  
  def randrange(n, vmin, vmax):
      '''
      Helper function to make an array of random numbers having shape (n, )
      with each number distributed Uniform(vmin, vmax).
      '''
      return (vmax - vmin)*np.random.rand(n) + vmin
  
  def fun_ebene(x, y):
      return x+y-breite**2/2
  
  #function for points
  def fun_punkte(x,y):
      return -x**2
  
  # min and max of the plane
  maximum=-99999.9
  minimum=99999.9
  for x in randrange(n, -breite, breite):
      for y in randrange(n, -breite, breite):       
          maximum=max(maximum,fun_ebene(x,y))
          minimum=min(minimum,fun_ebene(x,y))
  
  # cache that the points not touch the plane
  cache=(maximum-minimum)/10
  
  #generate points
  xs = randrange(n, -breite, breite)
  ys = randrange(n, -breite, breite)
  zs = randrange(n, fun_punkte(xs,ys)+cache, maximum)
  zs=fun_punkte(xs,ys)
  axlistxs = []
  axlistys = []
  axlistzs = []
  bxlistxs = []
  bxlistys = []
  bxlistzs = []
  
   #seperates Data in two lists
   for i in range(len(zs)):
      if zs[i]&lt;=fun_ebene(xs[i],ys[i]):
          axlistxs.append(xs[i])
          axlistys.append(ys[i])        
          axlistzs.append(zs[i])
      else:  
          bxlistxs.append(xs[i])
          bxlistys.append(ys[i])        
          bxlistzs.append(zs[i])
  
  fig = plt.figure()
  fig2 = plt.figure()
  ax = fig.add_subplot(111, projection='3d')
  bx = fig2.add_subplot(111, projection='3d')
  
  #set limes for the coordinate system
  ax.set_xlim(-22,22)
  ax.set_ylim(-22,22)
  ax.set_zlim(0, -400)
  bx.set_xlim(-22,22)
  bx.set_ylim(-22,22)
  bx.set_zlim(0, -400)
  
  def _update_plot(i, fig, scat):
      axlistzs = []
      # sets the z-coordinate +1 every frame
      for date in range(0, len(axlistxs)):
           axlistzs.append(-i)
      list1 =[]
      list1.append(axlistxs) #x-coordinates
      list1.append(axlistys) #y-coordinates
      list1.append(axlistzs) #z-coordinates
      scat._offsets3d = (*np.array(list1),)
      return scat
  
  def _update_plot2(i, fig, scat2):
      bxlistzs = []
      for  data in range(0, len(bxlistxs)):
          bxlistzs.append(-i)
      list2 = []
      list2.append(bxlistxs) #x-coordinates
      list2.append(bxlistys) #y-coordinates
      list2.append(bxlistzs) #z-coordinates
      np.array(list2)
      scat2._offsets3d = (*np.array(list2),)
      return scat2
  
  #plot data
  scat = ax.scatter([], [], color='red', marker='o') 
  scat2 = bx.scatter([], [], color = 'blue', marker = '^')
  
  anim = animation.FuncAnimation(fig, _update_plot, fargs=(fig, scat),    
  frames=100, interval=100)
  
  anim2 = animation.FuncAnimation(fig2, _update_plot2, fargs=(fig2, scat2),  
  frames=100, interval=100)
  
  plt.show()
  </code></pre>
  
  <p>my problem is that i want all that in only one figure/animation. But i don't know how to scatter two different colors and shapes. in the update function i use:</p>
  
  <pre><code>scat._offsets3d = (*np.array(list1),)
  </code></pre>
  
  <p>to update a list of multiple x.y.z-coordinates, after that the data gets scattered by</p>
  
  <pre><code>scat = ax.scatter([], [], color='red', marker='o') 
  </code></pre>
  
  <p>I see there no possibility to plot two different lists of classes in different colors and shapes in one figure. i hope somebody can help.</p>