### 53.1 Introduction to draw

`draw` is a Maxima-Gnuplot and a Maxima-VTK interface.

There are three main functions to be used at Maxima level:

- `draw2d`, draws a single 2D scene.
- `draw3d`, draws a single 3D scene.
- `draw`, can be filled with multiple `gr2d` and `gr3d` commands that each creates a draw scene all sharing the same window.

Each scene can contain any number of objects and `key=value` pairs with options for the scene or the following objects.

A selection of useful objects a scene can be made up from are:

- `explicit` plots a function.
- `implicit` plots all points an equation is true at.
- `points` plots points that are connected by lines if the option `points_joined` was set to `true` in a previous line of the current scene.
- `parametric` allows to specify separate expressions that calculate the x, y (and in 3d plots also for the z) variable.

A short description of all draw commands and options including example plots (in the html and pdf version of this manual) can be found in the section See Functions and Variables for draw. An online version of the html manual can be found at https://maxima.sourceforge.io/docs/manual/maxima_singlepage.html#draw. More elaborated examples of this package can be found at the following locations:

http://riotorto.users.sourceforge.net/Maxima/gnuplot/
http://riotorto.users.sourceforge.net/Maxima/vtk/

Example:

    (%i1) draw2d(
              title="Two simple plots",
              xlabel="x",ylabel="y",grid=true,

              color=red,key="A sinus",
              explicit(sin(x),x,1,10),
              color=blue,line_type=dots,key="A cosinus",
              explicit(cos(x),x,1,10)
    )$

You need Gnuplot 4.2 or newer to run draw; If you are using wxMaxima as a front end `wxdraw`, `wxdraw2d` and `wxdraw3d` are drop-in replacements for draw that do the same as `draw`, `draw2d` and `draw3d` but embed the resulting plot in the worksheet.

If you want to use VTK with draw, you need VTK with the Python interface installed (the dynamics-pkg uses VTK with the TCL interface!) and set the variable:

`draw_renderer: 'vtk $`

·

Categories: Plotting ·Share packages ·Package draw