Alphabetical list Categories
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 garea versus area and patch. See also shiftedline 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)]])

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