title: Plotting histograms on 3D axes with Python
body: <p>I am trying to plot a few histograms on a 3d axis using the PolyCollection function, my desired plot looks something like this: (except of course the coloured plots are histograms) <a href="https://i.stack.imgur.com/lJ1hQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lJ1hQ.png" alt="enter image description here" /></a></p>
  <p>For me, my x-values are the distribution of values of a parameter C_l, y-values are the values of l (ranging from 2 to 33) and z is the frequency of each C_l (so the histogram is on the x-z plane, with y specifying the histogram for each value of l). This is the code I have but I can't seem to get it to work:</p>
  <pre><code>fig = plt.figure()
  ax = fig.gca(projection='3d')
  nside=16
  
  'multi_dens_auto_cl_dist is just a 33x1001 matrix of all the C_l values, with the rows denoting each iteration I calculated previously and the columns being the l's)
  xs=np.linspace(multi_dens_auto_cl_dist.min(),multi_dens_auto_cl_dist.max(),num=1001)
  
  def cc(arg):
      return mcolors.to_rgba(arg, alpha=0.6)
  
  verts = []
  zs = np.arange(2,2*nside+1,1)
  
  for z in zs:
      ys,binvals,_ = plt.hist(multi_dens_auto_cl_dist[:][z],bins=xs)
      ys[0], ys[-1] = 0, 0
      verts.append(list(zip(xs, ys)))
  
  poly = PolyCollection(verts,facecolors=[cc('r'), cc('g'), cc('b'), cc('y')]*4+[cc('r')])
  poly.set_alpha(0.7)
  ax.add_collection3d(poly, zs=zs, zdir='y')
  
  ax.set_xlabel('X')
  ax.set_ylabel('Y')
  ax.set_zlabel('Z')
  
  
  plt.title('Density auto power spectrum distribution')
  plt.show()
  </code></pre>
  <p>Any help would be greatly appreciated thank you!</p>
  <p><a href="https://drive.google.com/file/d/1CcfTfq82jYnKF0YVAAWTiERIT1uHcaiT/view?usp=sharing" rel="nofollow noreferrer">Data file of multi_dens_auto_cl_dist</a></p>