Alphabetical list Categories
cbar Add a vertical color bar to a figure
Call signature:

cbar(x0=None, y0=None, y1=None, width=5, dist=10)

Help text:

cbar() without arguments creates a color bar to the right of the latest imsc.
cbar(x0, y0, y1) adds a vertical color bar to the figure between (x0, y0) and (x0, y1), expressed in data coordinates.
If y1>y0, the color bar runs up, otherwise it runs down.
Optional argument width specifies the width of the color bar in points (default: 5 points). If width is positive, the bar extends to the right of x0, otherwise to the left.
Optional argument dist creates distance between x0 and the color bar by shifting the color bar to the right. (Negative dist shifts it to the left.) This only works after a preceding imsc and uses the lookup table (lut) used by that imsc.
Use caxis to place an axis along the bar.
See also hcbar.

Example:

import qplot as qp

import numpy as np

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

xx = np.tile(np.linspace(0,3*np.pi,101), (101,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('', [-1, 0, 1], ['negative', '0', 'positive'])

qp.minorticks(np.arange(-.75, 1, .25))

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