Previous Up Next

26.3.2  Parameters for changing features

Graphical features are changed by giving appropriate values to certain parameters. Several values can be given at once with an expression of the form feature=value1+value2+…+valueN. Some values can be set using optional arguments to graphic commands, which will set the feature locally; namely, it will only apply to that particular graphic object. Some values can be specified at the beginning of a line, which will set the feature globally; it will apply to all the graphic objects created on that line. For some features, both options are available.

Parameters for local features.

Commands which create graphic objects, such as triangle, can have optional arguments to change a features of the object. For example, the argument color=red will make an object red.

triangle(1+i/2,2+i,1/2+2i,color=red)

The features and their possible values are:

Examples (of the filled option)

triangle(1+i/2,2+i,1/2+2i,display=filled)

To see the rainbow colors, you can enter and compile the program:

rainbow():={ local j,C; C:=[]; for (j:=256;j<382;j++) { C:=append(C,square(j,j+1,color=j+filled)); } }

followed by

axes=false; rainbow();

The number of a color is its x-coordinate. To see just one color, say the color corresponding to n for 256 ≤ n ≤ 381, enter: rainbow()[n-256].

Parameters for global features.

Parameters set at the beginning of a line change features on the entire graphic screen. It only takes effect when the line ends with a graphic command. For example, starting the line with title=titlestring will give the graphic screen a title.

Example

title="Some triangles"; triangle(0+i/5,1+i/5,1+i); triangle(2+i/5,3+i/5,3+i);

The parameters for global features and their possible values are:


Previous Up Next