This class is not currently supported by PyNarcisse.
A Lines object contains the specifications for a set of disjoint lines. It has only keyword arguments, in the form ``keyword = <value>''. It has methods set and new, which function the same as the Curve methods by the same name (see Section "Description" on page 9). The following keywords arguments are allowed:
These keywords are described in the next subsection.
The following keyword arguments can be specified for a Lines object:
x0 = <sequence of floating point values>
y0 = <sequence of floating point values>
x1 = <sequence of floating point values>
y1 = <sequence of floating point values>
x0, y0, x1, and y1 can actually be scalars, but if arrays must match in size and shape. (x0[i], y0[i]) represents the starting point of the ith line, and (x1[i], y1[i]) represents its endpoint.
color = one of the legal values for PyGist (currently the only package supporting Lines). See gist.help for details.
hide = 0/1 (1 to hide this part of the graph)
width = width of the lines. 1.0 (pretty narrow) is the default. Successive values 2.0, 3.0, ... roughly represent width in pixels.
type = "solid", "dash", "dot", "dashdot", "dashdotdot", and "none" (in which case the lines will be plotted as characters).
The first example draws a series of lines starting at a set of equally spaced points along the x axis and ending at a set of equally spaced points along the vertical line x = 49. Subsequent commands change the plot as explained in the comments.
Note once again that the Graph2d object g0 contains a reference to ly; hence when we change some of the characteristics of ly, g0 will know about these changes.
The second example is more complicated, but is worth studying. It uses two functions to compute the endpoints of the lines; let us examine these functions first. Note that function a2 assumes that the Numeric module's name space has been imported.
This function takes what spanz returns (which is a sequence of n - 1 items, as we shall see below), concatenates it to itself n - 1 times (the ``*'' is not multiplication, but replication), turns it into an array, then reshapes it into a two-dimensional array n - 1 by n - 1.
The spanz function is as follows:
The spanz function divides the interval from lb to ub into n parts, such that the interior subintervals are of equal length, and the two end subintervals are each half of that length.and returns the sequence of n - 1 equally spaced points which divide it into these n parts. If you do not understand how this function works, we recommend it as an excellent exercise to learn about the application of the map function and the lambda operator in Python.1
Although this manual is not a Python text, it might be instructive to study the following version of function a2, which does the same thing as the above a2 and spanz together:
With the help of these two auxiliary functions, or just the latter one, if you prefer, the following code will draw the graph of an interesting seventeen-pointed star:
See the Python Library Reference, page 17, for a description of map. The Python Reference Manual, p. 29, describes lambda email@example.com Copyright © 1997,Regents of the University of California. All rights reserved.