<<<<<<<<<<<<<<<<<

Plot_data(x) LYMB Plot_data(x)

NAME

plot_data - a data set for an xplot object

DESCRIPTION

The plot_data class is used to hold the 2D data set that is displayed by the xplot object. In addition, an Xgc object can be set in the plot_data object to control how the data is displayed in the X window.

Plot_data also interfaces with the display_data object or filters (i.e., any object that answers "data?" by returning a display_data pointer on the argument stack). Plot_data constructs its 2D data from the 3D display_data by using the point coordinates to compute arc length for the x values, and scalar data for the y values.

SUPERCLASS

object

INSTANCE VARIABLES

on Flag indicating whether the data set is on, that is, whether it will be drawn.

num_x_pts The number of x values.

num_y_pts The number of y values.

x_range The min and max x value.

y_range The min and max y value.

gc The name of the gc to use when drawing the data set.

data The data points as xy pairs.

x The value of independent variable for calculating dependent variable value.

y The value of dependent variable.

x_3d The boolean variable specifying that x_data accepts as input 3D points.

display_data The name of a display_data object or filter. This data supersedes all other data provided to plot_data.

MESSAGES

on! Turn the data set on.

off! Turn the data set off.

num_x_pts[=?] Set/get the number of x values.

num_y_pts[=?] Set/get the number of y values.

x_range[=?] Set/get the range of x values.

y_range[=?] Set/get the range of y values.

gc[=?] Set/get the name of the gc.

x_data[=+] Set/add the x data values. For x_3d set ON only "=" method is implemented and it accepts either a list of 3D points or a pointer to these points and their number.

y_data[=+] Set/add the y_data values.

xy_data[=+] Set/add both x and y data values as pairs.

data? Returns the address of the data values. This message can only be used inside source code.

x=, @ Sets the value of independetnt variable.

x? Returns the value of independent variable.

y? Returns the value of dependent variable.

x_3d[= 1,_on!,= 0,_off!] Sets the x_3d variable ON (OFF).

display_data[=?] Set/get the name of the display_data object or filter.

EXAMPLES

The following LYMB script shows how to plot a simple data set. Two plot_data objects are created and one is given a gc to give it a different appearance on the screen. Since x_data values are not specified, they default to (0, 1, ..., num_y_pts).

/* * make a GC for a different line type */ xgc new: gc_dotted

background=[white pixel?]

foreground=[green pixel?]

line_width=1

create!

line_style= 1

dashes= (3, 1)

change! ;

/* * make some data sets - give data2 a different line type via the GC */ plot_data new: data1 y_data=( 0,40,10,60,10,80,50,100,-10,30) ;

plot_data new: data2 y_data=(10,30,20,50,20,70,60,90, 0,20) gc=gc_dotted ;

xplot new: pl window=xw lines! data_sets=(data1,data2) ;

pl draw!;

SEE ALSO

xplot, xgc, dislpay_data, display_filter


Please send comments and suggestions to
consult@rpi.edu