gline
Generalized line drawing
Call signature:
gline(ptspecs)
Help text:
gline([ptspec1, ptspec2, ...]).
A PTSPEC is a list containing commands from the following list:
absdata(x, y) Absolute data coordinates. (This respects the transformation set by xtransform and ytransform.)
reldata(dx, dy) Relative data coordinates. (This does not respect those transformations.)
abspaper(x, y) Absolute paper coordinates (in pt)
relpaper(dx, dy)Relative data coordinates (in pt)
rotdata(xi, eta)Rotate by atan2(eta, xi) in data space. (This affects subsequent relative positioning.)
rotpaper(phi) Rotate by phi radians. (This affects subsequent relative positioning.)
retract(l) Retract preceding and following segments by L pt.
retract(l1, l2) Retract preceding and following segments by L1 and L2 pt respectively.
at(id) Absolute paper coordinates of location set by at.
atx(id) Absolute paper x-coordinate of location set by at.
aty(id) Absolute paper y-coordinate of location set by at.
For instance,
gline([[AbsData(0, 1), RelPaper(5,0)], [AbsData(2, 3), RelPaper(0, 7)]])
draws a line from 5 pt to the right of the point (0, 1) in the graph to 7 pt below the point (2, 3) in the graph. (Note that paper y-coordinates increase toward the bottom of the graph while data y-coordinates increase toward the top.)
Note: The rather cumbersome syntax of gline makes line and plot more attractive for general usage. The same applies to gpoly versus fill and poly.
See also shiftedline, gpoly, and gline2.
Example:

import qplot as qp

import numpy as np

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

xx = np.arange(-1.5*np.pi, 1.5*np.pi)

yy = np.cos(xx)

qp.marker('o', fill='solid')

qp.mark(xx, yy)

N=len(xx)

for n in range(N-1):

        qp.gline([[qp.AbsData(xx[n], yy[n]), qp.Retract(10)],

                            [qp.AbsData(xx[n+1],yy[n+1]), qp.Retract(10)]])