xaxis(title='', ticks=None, labels=None, y=0, lim=None, flip=False, ticklen=None, axshift=None, lbldist=None, ttldist=None, microshift=False)
All arguments are optional.
title specifies title for axis.
ticks specifies positions of ticks along axis. If None, ticks are inferred using sensibleticks. If [], no ticks are drawn.
labels specifies labels to put by ticks. If None, tick coordinates are used. If [], no labels are drawn.
y specifies intersect with y-axis in data coordinates. Default is zero. Set to None to automatically position below the data.
lim specifies left and right edges as a tuple or list. If None, lim is determined from ticks. If [], no line is drawn.
flip, if True, inverts the sign of the settings from ticklen, textdist, and axshift.
ticklen and axshift override the values from the corresponding command.
lbldist and ttldist override the values from textdist.
microshift, if True, specifies that the ticks are to be shifted by up to half a linewidth so they don't protrude horizontally past the ends of an image. May also be a 2-ple specifying behavior for the left and right ends separately.
Either ticks or labels (but not both) may be a function, in which case the labels are calculated from the tick positions (or vice versa). For example:
xaxis('Value (%)', labels=np.arange(0,101,25), ticks=lambda x: x/100)
Without any arguments or with just a title as an argument, xaxis tries to determine sensible defaults based on previous calls to plot and friends. Your mileage may vary.
import qplot as qp
import numpy as np
qp.figure('xaxis', 3, 3)
qp.xaxis('x-axis', np.arange(6))
qp.xaxis('', np.arange(6), ['zero', 'one', 'two', 'three', 'four', 'five'], y=1)
qp.xaxis('', np.arange(6), lambda x: '%g%%' % (10*x), y=2)
qp.xaxis('', np.arange(1,5), lim=[0, 5], y=3)
qp.xaxis('', np.arange(6), [], y=4)
qp.xaxis('top orientation', np.arange(6), y=5, flip=True)
qp.shrink()