Commands for global display features

### 11.3.3 Commands for global display features

#### Add a legend: legend

The legend command takes two arguments and an optional third. The arguments are:

- A position to put the legend. This can either be a point or a list of two integers giving the number of pixels from the upper left hand corner.
- The legend itself, a string or a variable.
- An optional third parameter indicating where to put the legend relative to the point. By default, it will be to the upper right of the point (quadrant1), but you can specify quadrant1, quadrant2, quadrant3 or quadrant4.

For example, to put "hello" to the upper left of the point (1,1):
Input:

legend(1+i,"hello",quadrant3)

or
Input:

legend(1+i,quadrant3,"hello")

Output:

#### Change various features:display color

The display command changes the properties of graphics; the same properties that can also be changed with the display and color parameters. (See section 11.3.2.) The color command is the same as the display command.

The display command can draw objects with specified properties. In this case, the first argument will be a command to create the object and the second argument will be a value for the display or color parameter. Both
Input:

display(triangle(0,1,1+i),red)

and
Input:

triangle(0,1,1+i,display=red)

draw
Output:

Similarly, both
Input:

triangle(0,1,1+i,display=filled)

and
Input:

display(triangle(0,1,1+i),filled)

draw
Output:

The display command can also take a second argument of hidden_name. By default, if a geometric object is named, the drawing is labeled.
Input:

A := triangle(0,1,1+i)

Output:

Creating the object with the display command and the hidden_name argument will draw it without the label.
Input:

display(A := triangle(0,1,1+i),hidden_name)

Output:

The display command can also be used without drawing an object, such as display(hidden_name) or display(filled). In this case it will be a global command; the display effect will apply to all objects afterwards. Entering display(0) will reset the display parameters; afterwards, for example, the colors will be black, the figures won’t be filled, and the objects will have labels.