## `plot` -- display graphical objects on the screen

#### Introduction

`plot``(scene)` displays a graphical scene on the screen.

`plot``(object1, object2...)` displays the graphical objects `object1`, `object2` etc. on the screen.

#### Call(s)

`plot(scene)`
`plot(object1 <, object2...> <, option1, option2...>)`

#### Parameters

`scene` | - | a graphical scene: an object of domain type `plot::Scene`
`object1, object2, ...` | - | 2D or 3D graphical objects
`option1, option2, ...` | - | scene options of the form `OptionName = value`

### Overloadable:

`object1`

#### Related Domains

`plot::Scene`

#### Related Functions

`plot2d`, `plot3d`

#### Details

- Graphical scenes may be created by `plot::Scene`. See the corresponding help page for details.
- The parameters `object1`, `object2` etc. must be graphical objects generated by routines of the library `plot`. Graphical primitives include function graphs (of domain type `plot::Function2d` and `plot::Function3d`), points and polygons (of domain type `plot::Point` and `plot::Polygon`, respectively), and surfaces (of domain type `plot::Surface3d`). Cf. example 1.
- High level functions of the `plot` library such as `plot::vectorfield`, `plot::ode`, or `plot::implicit` return more complex graphical objects that can also be rendered via the function `plot`. Cf. example 2.
- Scene options `option1`, `option2` etc. are specified by equations `OptionName = value`. Please refer to the help page of `plot::Scene` for a table of all admissible plot options.

- The graphical objects `object1`, `object2` etc. must have the same dimension. A mix of two- and three-dimensional primitives in a single scene is not supported!

#### Example 1

The following calls return objects representing the graphs of the sine and the cosine function on the interval [0, 2*PI]:

    >> f1 := plot::Function2d(sin(x), x = 0..2*PI);
       f2 := plot::Function2d(cos(x), x = 0..2*PI, Color = RGB::Blue)

                       plot::Function2d(sin(x), x = 0..2 PI)

                       plot::Function2d(cos(x), x = 0..2 PI)

The following call renders these graphs:

    >> plot(f1, f2)

This call uses the default values of the scene options as documented on the help page of `plot::Scene`. Scene options may be passed as additional parameters to `plot`. For example, to draw grid lines in the background of the previous plot, we enter:

    >> plot(f1, f2, GridLines = Automatic)

See `plotOptions2d` for details on the `GridLines` option.

    >> delete f1, f2:

#### Example 2

The `plot` library contains various routines for creating more complex graphical objects such as vectorfields, solution curves of ordinary differential equations, and implicitly defined curves.

For example, to plot the implicitly defined curve x^3 + x + 2 = y^2 with x, y from the interval [-5,5], we use the function `plot::implicit`:

    >> plot(
            plot::implicit(
               x^3 + x + 2 - y^2, x = -5..5, y = -5..5
            ),
            Scaling = Constrained
           )

Here we used the `Scaling` option to guarantee an aspect ratio 1:1 between the x and y coordinates independent of the window size (see `plotOptions2d` for details).

#### Background

- Technically, `plot` is not a function but a domain representing the library `plot`. Thus, when calling `plot(...)`, the method `plot``::new(...)` is called.

  The method `"new"` works as follows: If the parameter `scene` is given, the method `"getPlotdata"` of the domain `plot::Scene` is called. It returns the graphical scene in a `plot2d` conforming syntax (or `plot3d` if the scene is three-dimensional). Then the result is passed to the function `plot2d` or `plot3d`, respectively.

  If the graphical objects `object1`, `object2` etc. are given as parameters, the method `plot``::new` first creates a scene of domain type `plot::Scene` consisting of these objects. Then it proceeds as described above.

#### Changes

- `plot` is a new domain.

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000