parameters: (ax, positions,colors)
docstring: import matplotlib.pyplot as plt
      fig = plt.figure(figsize=(15,15))
      ax = fig.gca(projection='3d')
      ...
      plt.show()
docstring_summary: import matplotlib.pyplot as plt
      fig = plt.figure(figsize=(15,15))
      ax = fig.gca(projection='3d')
      ...
      plt.show()
docstring_tokens: import matplotlib . pyplot as plt fig = plt . figure ( figsize = ( 15 15 )) ax = fig . gca ( projection = 3d ) ... plt . show ()
function: def matplotlib_planes(ax, positions,colors):
      from mpl_toolkits.mplot3d import Axes3D
      from mpl_toolkits.mplot3d.art3d import Poly3DCollection
      """
      import matplotlib.pyplot as plt
      fig = plt.figure(figsize=(15,15))
      ax = fig.gca(projection='3d')
      ...
      plt.show()
      """
      try:
          positions=positions.numpy()
          colors=colors.numpy()
          X = np.array([[[0, -0.5, 0.5], [0, -0.5, -0.5], [0, 0.5, -0.5], [0, 0.5, 0.5]]]).astype(np.float32)[None]
          X=X+positions[:,None,None,:]
          X.resize(X.shape[0]*1,4,3)
          m=positions.min(0)
          M=positions.max(0)+1
          ax.set_xlim([m[0],M[0]])
          ax.set_ylim([m[1],M[1]])
          ax.set_zlim([m[2],M[2]])
          ax.add_collection3d(Poly3DCollection(X,
                                  facecolors=np.repeat(colors,1, axis=0)))
      except:
          pass
      ax.set_axis_off()
function_tokens: def matplotlib_planes ( ax , positions , colors ) : from mpl_toolkits . mplot3d import Axes3D from mpl_toolkits . mplot3d . art3d import Poly3DCollection try : positions = positions . numpy ( ) colors = colors . numpy ( ) X = np . array ( [ [ [ 0 , - 0.5 , 0.5 ] , [ 0 , - 0.5 , - 0.5 ] , [ 0 , 0.5 , - 0.5 ] , [ 0 , 0.5 , 0.5 ] ] ] ) . astype ( np . float32 ) [ None ] X = X + positions [ : , None , None , : ] X . resize ( X . shape [ 0 ] * 1 , 4 , 3 ) m = positions . min ( 0 ) M = positions . max ( 0 ) + 1 ax . set_xlim ( [ m [ 0 ] , M [ 0 ] ] ) ax . set_ylim ( [ m [ 1 ] , M [ 1 ] ] ) ax . set_zlim ( [ m [ 2 ] , M [ 2 ] ] ) ax . add_collection3d ( Poly3DCollection ( X , facecolors = np . repeat ( colors , 1 , axis = 0 ) ) ) except : pass ax . set_axis_off ( )