docs: def plot_colorbar(
      cax=None,
      cmap="default",
      ticks=None,
      clim=None,
      vlim=None,
      label=None,
      tick_fontsize=14,
      label_fontsize=18,
      decimals=None,
      orientation="vertical",
      ticklocation="auto",
      extend="neither",
      extendfrac=None,
      extendrect=False,
  ):
      """Easily add a colormap to an axis.
  
      Parameters
      ----------
      cax : matplotlib axis (optional)
          The axis to plot the colorbar on. Finds the current axis if none is
          given.
      cmap : string or LinearSegmentedColormap (optional)
          The colormap to fill the colorbar with. Strings map as keys to the
          WrightTools colormaps dictionary. Default is `default`.
      ticks : 1D array-like (optional)
          Ticks. Default is None.
      clim : two element list (optional)
          The true limits of the colorbar, in the same units as ticks. If None,
          streaches the colorbar over the limits of ticks. Default is None.
      vlim : two element list-like (optional)
          The limits of the displayed colorbar, in the same units as ticks. If
          None, displays over clim. Default is None.
      label : str (optional)
          Label. Default is None.
      tick_fontsize : number (optional)
          Fontsize. Default is 14.
      label_fontsize : number (optional)
          Label fontsize. Default is 18.
      decimals : integer (optional)
          Number of decimals to appear in tick labels. Default is None (best guess).
      orientation : {'vertical', 'horizontal'} (optional)
          Colorbar orientation. Default is vertical.
      ticklocation : {'auto', 'left', 'right', 'top', 'bottom'} (optional)
          Tick location. Default is auto.
      extend : {‘neither’, ‘both’, ‘min’, ‘max’} (optional)
          If not ‘neither’, make pointed end(s) for out-of- range values.
          These are set for a given colormap using the colormap set_under and set_over methods.
      extendfrac :	{None, ‘auto’, length, lengths} (optional)
          If set to None, both the minimum and maximum triangular colorbar extensions
          have a length of 5% of the interior colorbar length (this is the default setting).
          If set to ‘auto’, makes the triangular colorbar extensions the same lengths
          as the interior boxes
          (when spacing is set to ‘uniform’) or the same lengths as the respective adjacent
          interior boxes (when spacing is set to ‘proportional’).
          If a scalar, indicates the length of both the minimum and maximum triangular
          colorbar extensions as a fraction of the interior colorbar length.
          A two-element sequence of fractions may also be given, indicating the lengths
          of the minimum and maximum colorbar extensions respectively as a fraction
          of the interior colorbar length.
      extendrect :	bool (optional)
          If False the minimum and maximum colorbar extensions will be triangular (the default).
          If True the extensions will be rectangular.
  
      Returns
      -------
      matplotlib.colorbar.ColorbarBase object
          The created colorbar.
      """
      # parse cax
      if cax is None:
          cax = plt.gca()
      # parse cmap
      if isinstance(cmap, str):
          cmap = colormaps[cmap]
      # parse ticks
      if ticks is None:
          ticks = np.linspace(0, 1, 11)
      # parse clim
      if clim is None:
          clim = [min(ticks), max(ticks)]
      # parse clim
      if vlim is None:
          vlim = clim
      if max(vlim) == min(vlim):
          vlim[-1] += 1e-1
      # parse format
      if isinstance(decimals, int):
          format = "%.{0}f".format(decimals)
      else:
          magnitude = int(np.log10(max(vlim) - min(vlim)) - 0.99)
          if 1 > magnitude > -3:
              format = "%.{0}f".format(-magnitude + 1)
          elif magnitude in (1, 2, 3):
              format = "%i"
          else:
              # scientific notation
              def fmt(x, _):
                  return "%.1f" % (x / float(10 ** magnitude))
  
              format = matplotlib.ticker.FuncFormatter(fmt)
              magnitude_label = r"  $\mathsf{\times 10^{%d}}$" % magnitude
              if label is None:
                  label = magnitude_label
              else:
                  label = " ".join([label, magnitude_label])
      # make cbar
      norm = matplotlib.colors.Normalize(vmin=vlim[0], vmax=vlim[1])
      cbar = matplotlib.colorbar.ColorbarBase(
          ax=cax,
          cmap=cmap,
          norm=norm,
          ticks=ticks,
          orientation=orientation,
          ticklocation=ticklocation,
          format=format,
          extend=extend,
          extendfrac=extendfrac,
          extendrect=extendrect,
      )
      # coerce properties
      cbar.set_clim(clim[0], clim[1])
      cbar.ax.tick_params(labelsize=tick_fontsize)
      if label:
          cbar.set_label(label, fontsize=label_fontsize)
      # finish
      return cbar