docs: def plot_density(population,  # pylint: disable=too-many-arguments, too-many-locals
                   bins=100, new_fig=True, subplot=111, levels=None, plane='xy',
                   colorlabel='Nodes per unit area', labelfontsize=16,
                   color_map='Reds', no_colorbar=False, threshold=0.01,
                   neurite_type=NeuriteType.basal_dendrite, **kwargs):
      '''Plots the 2d histogram of the center
         coordinates of segments in the selected plane.
      '''
      fig, ax = common.get_figure(new_fig=new_fig, subplot=subplot)
  
      H1, xedges1, yedges1 = extract_density(population, plane=plane, bins=bins,
                                             neurite_type=neurite_type)
  
      mask = H1 < threshold  # mask = H1==0
      H2 = np.ma.masked_array(H1, mask)
  
      getattr(plt.cm, color_map).set_bad(color='white', alpha=None)
  
      plots = ax.contourf((xedges1[:-1] + xedges1[1:]) / 2,
                          (yedges1[:-1] + yedges1[1:]) / 2,
                          np.transpose(H2), # / np.max(H2),
                          cmap=getattr(plt.cm, color_map), levels=levels)
  
      if not no_colorbar:
          cbar = plt.colorbar(plots)
          cbar.ax.set_ylabel(colorlabel, fontsize=labelfontsize)
  
      kwargs['title'] = kwargs.get('title', '')
      kwargs['xlabel'] = kwargs.get('xlabel', plane[0])
      kwargs['ylabel'] = kwargs.get('ylabel', plane[1])
  
      return common.plot_style(fig=fig, ax=ax, **kwargs)