Alphabetical list Categories
caxis Plot colorbar axis
Call signature:

caxis(title=None, ticks=None, labels=None, lim=None, flip=False, ticklen=None, axshift=None, lbldist=None, ttldist=None, titlerot=None, microshift=True)

Help text:

caxis plots a colorbar axis alongside the most recent cbar or hcbar.
All arguments are optional.
  title specifies a title for the axis.
  ticks specifies the locations of the ticks in terms of the data represented in the imsc for which the colorbar was drawn.
  labels specifies labels to be written by those ticks. If None, labels are derived from ticks. If [], no labels are written.
  lim specifies the ends of the axis, again in terms of the data represented in the imsc.
  flip specifies that the axis is rendered to the left or above the bar rather than to the right or below.
  ticklen and axshift override the values from the corresponding command.
  lbldist and ttldist override the values from textdist.
  titlerot overrides the value from ytitlerot.
  microshift (default true) specifies that the ticks are to be shifted by up to half a linewidth so they don't protrude past the bar's ends.

caxis interprets settings from ticklen, textdist, and axshift differently from xaxis and yaxis: positive values are away from the colorbar. Note that minorticks currently doesn't understand about this convention, so minorticks may produce unexpected results when used with caxis.

Example:

import qplot as qp

import numpy as np

qp.figure('caxis', 3, 3)

xx = np.tile(np.arange(11), (11,1))

yy = np.transpose(xx)

zz = np.cos(xx) * np.sin(yy)

qp.imsc(zz, [0, 0, 1, 1], c0=-1, c1=1)

qp.cbar()

qp.caxis('', np.arange(-1,1.1,1), ['negv', '0', 'posv'])

qp.caxis('', np.arange(-1,1.1,.2), [], flip=True)

qp.hcbar()

qp.caxis('', [-1, 0, 1])

qp.caxis('', [-.5, .5], [], flip=True)

QPlot Documentation — (C) Daniel Wagenaar, 2014–2023