Alphabetical list Categories
hcbar Add a horizontal color bar to a figure
Call signature:

hcbar(y0=None, x0=None, x1=None, width=5, dist=10)

Help text:

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

Example:

import qplot as qp

import numpy as np

qp.figure('hcbar', 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.hcbar()

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

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

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