code: def colorbar_hack(ax, vmin, vmax, cmap, scientific=False, cbarlabel=None,
                    **kwargs):
      
      # http://stackoverflow.com/questions/8342549/matplotlib-add-colorbar-to-a-sequence-of-line-plots
      norm = plt.Normalize(vmin=vmin, vmax=vmax)
      sm = plt.cm.ScalarMappable(cmap=cmap, norm=norm)
      sm._A = []
      cb = plt.colorbar(sm, ax=ax, **kwargs)
      if cbarlabel is not None:
          cb.set_label(cbarlabel)
      if scientific:
          cb.locator = matplotlib.ticker.LinearLocator(numticks=7)
          cb.formatter = matplotlib.ticker.ScalarFormatter()
          cb.formatter.set_powerlimits((0, 0))
          cb.update_ticks()
docs: Colorbar hack to insert colorbar on ternary plot. 
      
      Called by heatmap, not intended for direct usage.
      
      Parameters
      ----------
      vmin: float
          Minimum value to portray in colorbar
      vmax: float
          Maximum value to portray in colorbar
      cmap: Matplotlib colormap
          Matplotlib colormap to use