Adds a line to a drawing area.
Integer_Type chips_line(x1,y1,x2,y2)
Integer_Type chips_line(x1,y1,x2,y2,color)
Integer_Type chips_line(x1,y1,x2,y2,color,width)
Integer_Type chips_line(x1,y1,x2,y2,color,width,style)
This is a S-Lang version of the ChIPS LINE command.
It draws a line from (x1,y1) to (x2,y2) in the current pane,
and the optional parameters control the color, width,
and linestyle. If a parameter is not specified, the value from
the ChIPS state object is used instead.
The function returns a 0 on success and -1 on failure.
Arguments for chips_line
x1 |
Numeric |
|
start of line |
y1 |
Numeric |
|
start of line |
x2 |
Numeric |
|
end of line |
y2 |
Numeric |
|
end of line |
color |
Integer_Type |
chips.linecolor |
|
width |
Numeric |
chips.linewidth |
|
style |
Numeric |
chips.linestyle |
|
The routine prints a usage message if used with the wrong
number of arguments:
chips> chips_line(1)
Usage: chips_line(x1,y1,x2,y2[,color[,width[,style]]])
chips_line(1);
chips> clear
chips> set_state_defaults("chips")
chips> chips_line(0,0,2,1)
0
Here we mix ChIPS and S-Lang commands. The CLEAR
command is used to remove any previous plots and
set the axis limits to 0 and 1.
Then we use S-Lang commands to reset the values in
the ChIPS state object and then to draw a line
between (0,0) and (2,1).
chips> clear
chips> chips_line(0.1,0.1,0.9,0.1,_chips->red,1,_chips->dotdash)
0
This draws a horizontal red line, using the DOTDASH style
and with a width of 1, between (0.1,0.1) and (0.9,0.1).
chips_clear();
chips.linecolor = _chips->red;
chips.linewidth = 1;
chips.linestyle = _chips->dotdash;
() = chips_line(0.1,0.1,0.9,0.1);
This part of a S-lang script has the same result as the
previous example. This time the ChIPS state object is
used to set the line parameters, rather than supplying
them as optional parameters to the "chips_line()"
function.
Note that any following lines will also be drawn in red
using the DOTDASH style until the ChIPS state
object is changed, or the attributes are explicitly
specified in the chips_line() call.
- chips
-
chips_auto_redraw,
chips_clear,
chips_color_name,
chips_color_value,
chips_get_pane,
chips_get_xrange,
chips_get_xscale,
chips_get_yrange,
chips_get_yscale,
chips_get_zrange,
chips_get_zscale,
chips_label,
chips_pickpoints,
chips_redraw,
chips_set_pane,
chips_set_xrange,
chips_set_xscale,
chips_set_yrange,
chips_set_yscale,
chips_set_zrange,
chips_set_zscale,
chips_split,
chips_version
|