title: 3d plot of list of (hist, bin_edges) where histogram bar chart or lines are in the z-y plane
body: <p>EDIT - reworked question</p>
  
  <p>I need to print a 3D histogram of fitness data for 50 generations of computer programmes.  This data is in calculated and stored in a logbook using the DEAP framework.  The form of the plot needs to be with the fitness frequency on the z axis, generation on the x axis and bin_edges on the y axis.  So the lines for the histogram are in the z-y plane, for each generation on the x-axis. </p>
  
  <p>The frequency data for each generation is contained in a numpy array of shape (#generations, #bin_edges), gained by running np.histogram() on each generation.</p>
  
  <pre><code>histograms = [el[0] for el in logbook.chapters["fitness"].select("hist")]
  
  histograms.shape
  (51, 10)  # (num gen, num bins)
  
  print (histograms)  # excerpt only
  [[ 826.  145.   26.    2.    1.    0.    0.    0.    0.    0.]
   [ 389.  446.  145.   16.    4.    0.    0.    0.    0.    0.]
   [ 227.  320.  368.   73.   12.    0.    0.    0.    0.    0.]
   [ 199.  128.  369.  261.   43.    0.    0.    0.    0.    0.]
   [ 219.   92.  158.  393.  137.    1.    0.    0.    0.    0.]
   [ 252.   90.   91.  237.  323.    6.    1.    0.    0.    0.]
   [ 235.   89.   69.   96.  470.   36.    5.    0.    0.    0.]
   [ 242.   78.   61.   51.  438.  114.   16.    0.    0.    0.]
   [ 235.   82.   52.   52.  243.  279.   57.    0.    0.    0.]]
  
  bin_edges
  array([  0.,   9.,  18.,  27.,  36.,  45.,  54.,  63.,  72.,  81.,  90.])
  
  gen
  [0, 1, 2, 3, 4, 5, 6, 7, 8, ...]
  </code></pre>
  
  <p>I've made several attempts, but can't seem to get the histogram data into the right format, or possibly shape for matplotlib axes.bar.  </p>
  
  <p><strong>ATTEMPT 2:</strong> busy reworking</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import matplotlib as mpl
  import numpy as np
  xedges = list(gen)
  yedges = list(bin_edges)
  H = histograms.T
  
  fig=plt.figure()
  # error on this line: TypeError: list indices must be integers or slices, not list
  ax = fig.add_subplot(133, title='NonUniformImage: interpolated', aspect='equal', \
  
  xlim=xedges[[0, -1]], ylim=yedges[[0, -1]])
  im = mpl.image.NonUniformImage(ax, interpolation='bilinear')
  xcenters = (xedges[:-1] + xedges[1:]) / 2
  ycenters = (yedges[:-1] + yedges[1:]) / 2
  im.set_data(xcenters, ycenters, H)
  ax.images.append(im)
  plt.show()
  </code></pre>
  
  <p><strong>ATTEMPT 1:</strong></p>
  
  <pre><code>fig = plt.figure()
  ax = fig.add_subplot(111, projection='3d')
  # I have a list of len(gen) histograms
  # with an array of freq count for each bin
  
  xs =  list(gen)
  ys = list(bin_edges)
  zs = hist.T #ndarray
  
  
  # error occurs here as 
  # ValueError: shape mismatch: objects cannot be broadcast to a single shape    
  ax.bar(xs, ys, zs)
  plt.show()
  </code></pre>