geomappy.plot_utils.create_colorbar_axes

geomappy.plot_utils.create_colorbar_axes(ax: Axes, *, location: str = 'right', width: float = 0.02, pad: float = 0.03, shrink: float = 1.0) Axes

Create an axes suitable for a colorbar next to a given axes.

Uses make_axes_locatable to place the colorbar next to the parent axes. If shrink is less than 1, the colorbar is centered within the allocated space.

Parameters:
  • ax (Axes) – The parent axes to attach the colorbar to.

  • location (str, default 'right') – Side of the axes to place the colorbar. Options are ‘right’, ‘left’, ‘top’, or ‘bottom’.

  • width (float, default 0.02) – Width (for vertical) or height (for horizontal) of the colorbar as a fraction of the parent axes.

  • pad (float, default 0.03) – Space between the parent axes and the colorbar as a fraction of the parent axes.

  • shrink (float, default 1.0) – Fraction of the colorbar length to display. Values less than 1 shrink the bar while keeping it centered.

Return type:

Axes