title: Plotting 2D efficiency with matplotlib
body: <p>I am trying to plot a 2D (in)efficiency in matplotlib, basically, I need the ration of two histograms. I am using panda DF to fill them:</p>
  
  <pre><code>X_arr = np.array(df['X'])
  Y_arr = np.array(df['Y'])
  
  Xeff_arr = np.array(df['X'][(df['condition'] == 1)]
  Yeff_arr = np.array(df['Y'][(df['condition'] == 1)]
  
  plt.figure()
  
  denom_histo, xedges, yedges = np.histogram2d(Y_arr, X_arr, bins=(100, 100))
  eff_histo, xedges, yedges = np.histogram2d(Yeff_arr, Xeff_arr, bins=(100, 100), weights=-1)
  ones, xedges, yedges = np.histogram2d(np.array(100*[1]), np.array(100*[1]), bins=(100, 100))
  
  ineff_histo = ones - eff_histo
  ineff_histo = ineff_histo / denom_histo
  
  plt.show()
  </code></pre>
  
  <p>I need inefficiency, so I calculate it by "1 - (data_passing_condition)/(all_data)" Also doing this prevents division by zero. </p>
  
  <p>But I get errors, like "ValueError: object of too small depth for desired array"</p>
  
  <p>Could you let me know what's the best way to deal with 2D plots in matplot?</p>
  
  <p>Cheers</p>