mechanochat.plotting.draw_colorbar#

mechanochat.plotting.draw_colorbar(cmap_name: str = 'Reds', cmap=None, norm: Normalize | None = None, vmax: float = 1., vmin: float = 0., orientation: Literal['horizontal', 'vertical'] = 'horizontal', label: str | None = None, label_size: float = 15., ticks: List | None = None, ticklabels: List | None = None, ticks_size: float = 15., save_name: str | None = None, ax: Axes | None = None)[source]#

Draw a standalone colorbar, e.g. one shared by several panels.

Parameters:
  • cmap_name (str, default 'Reds') – Valid matplotlib colormap name. Ignored when cmap is given

  • cmap (Colormap, optional) – Colormap object, e.g. the one returned by alphashape_plot(return_mappable=True)

  • norm (Normalize, optional) – Normalization object. Built from vmin / vmax if None

  • vmax (float, default 1.) – Bounds used when norm is None

  • vmin (float, default 0.) – Bounds used when norm is None

  • orientation ({'horizontal', 'vertical'}, default 'horizontal') – Colorbar orientation. Also sets the default figure size

  • label (str, optional) – Colorbar label

  • label_size (float, default 15.) – Label font size

  • ticks (list, optional) – Tick positions. Default: matplotlib’s automatic ticks

  • ticklabels (list, optional) – Tick labels

  • ticks_size (float, default 15.) – Tick label font size

  • save_name (str, optional) – Output path for figure saving (e.g., ‘figure.pdf’)

  • ax (Axes, optional) – Axes used as the colorbar axes. A new figure is created if None

Returns:

ax (Axes)