Previous Page Next Page Contents

plot::Pointlist -- graphical primitive for a list of points

Introduction

plot::Pointlist(p1, p2...) represents a plot of either two- or three-dimensional points. Several drawing options exist such as drawing a line from point to point, or drawing a horizontal or vertical line from the axes to each point.

Creating Elements

plot::Pointlist(p1, p2... <, option1, option2...>)

Parameters

p1, p2 - plot points, i.e., objects that can be converted into the domain plot::Point; the points must have the same dimension
option1, option2, ... - plot option(s) of the form OptionName = value

Related Domains

plot::Point, plot::Scene

Related Functions

plot, plot2d, plot3d, plot::copy

Details

Option: DrawMode =

value

Operands

The operands of an object of plot::Pointlist are the parameters p1, p2... (in this order).

Important Operations

Operands of a point-list primitive can be accessed either using the system function op, the index operator [ ], or using the attribute objects described above. For example, if pointlist is such an object, then the calls op(pointlist,1), pointlist[1] and pointlist::objects[1] return the first point of pointlist.

Via pointlist[1] := new_point or pointlist::objects[1] := new_point, the first point of pointlist is replaced by new_point.

See the methods "op", "_index", "set_index" and "slot" below.

Use the slot operator :: to get or set plot options of such objects afterwards, i.e., when they have been created. For example, if pointlist is such an object, then pointlist::Color := RGB::Red changes the color of each point of pointlist to red.

Result of Evaluation

Evaluating an object of type plot::Pointlist returns itself.

Function Call

Calling an object of plot::Pointlist primitive as a function yields the object itself, regardless of the arguments. The arguments are not evaluated.

Entries

defaultOptions

is a table of plot options for point-list primitives and their default values. Each entry has the form OptionName = default_value.

When an object of the domain plot::Pointlist is created, then a copy of this table is stored under the attribute options (see the table of attributes above), where those options are added and replaced, respectively, which are given by the (optional) parameters option1, option2... of the creating call (see ``Creating Elements'' above).

Plot options, which are not contained in the table stored under the attribute options will not be included in the plot data of the object created by the method "getPlotdata" (see below).

For those options, the corresponding default value either is set by a graphical scene, if the option also exists as a scene option (such as the option PointWidth), or it is internally set by the function plot2d and plot3d, respectively, which are used to plot the object. See the table of plot options above, which gives a summary of the available plot options for point-list primitives and their default values.

To change the default value of some plot options, the option name and its default value may be added to the table "defaultOptions", or replaced by a new value, respectively.

optionNames

is a set of the available option names for plots of point-lists.

Method _index: indexed access to the operands of a point-list primitive

Method dimension: dimension of a point-list primitive

Method getPlotdata: create the plot data of a point-list primitive

Method nops: number of operands of a point-list primitive

Method op: extract operands of a point-list primitive

Method set_index: set operands of a point-list primitive

Method slot: read and write attributes and plot options

Method checkOption: check a plot option

Method copy: create a copy of a point-list primitive

Method expose: expose the definition of a point-list

Method modify: modify a copy of a point-list primitive

Method print: print a point-list primitive

Example 1

This example illustrates the different modes for plotting lists of points. We start with the default mode, that is plotting each point of the list in the order as specified:

>> p1 := plot::Pointlist(
     plot::Point(i, exp(i)) $ i = 1..5 
   )
                             plot::Pointlist()

To plot the list of points created, call:

>> plot(p1)

If you want to connect every two points by a line, then use the option DrawMode=Connected:

>> p2 := plot::Pointlist( 
     plot::Point(i, exp(i)) $ i = 1..5, DrawMode = Connected 
   ):
   plot(p2)

Set the value of the option DrawMode to Vertical or Horizontal in order to draw a line from the x-axis and the y-axis, respectively, to each point of the list:

>> p2::DrawMode := Vertical: 
   plot(p2)
>> p2::DrawMode := Horizontal: 
   plot(p2)

Here, we used the slot operator :: to change the value of some plot options of the graphical primitive p2.

One can also combine plot modes for lists of points, such as plotting vertical and horizontal lines to each point:

>> p2::DrawMode := {Horizontal, Vertical}: 
   plot(p2)

Example 2

One can specify plot options for each point of the list. For example, to plot the points of a list in different sizes, enter:

>> p := plot::Pointlist(
     plot::Point(i, sin(i), PointWidth = 10*i) $ i = 1..10 
   ):
   plot(p)

A plot option of the object p acts on every point of the list, except of the points of the list, for which a plot option is set explicitely.

For example, if we change the value of the option Color of the object p to blue, then every point is drawn in blue color:

>> p::Color := RGB::Blue: 
   plot(p)

To set the color option for some points explicitely, such as changing the color of the last point to red, one may enter:

>> (p[10])::Color := RGB::Red: 
   plot(p)

The plot options of a plot-list object (here: p) also act on the connecting lines, if the option DrawMode is used.

For example, if we create a point-list and set the color of the points explicitely to blue, then connecting lines are still drawn in the default color of objects of the domain plot::Pointlist, i.e., in red color:

>> p2 := plot::Pointlist(
     plot::Point(i, i^2, Color = RGB::Blue) $ i = -5..5,
     DrawMode = Connected
   ):
   plot(p2)

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000