### 12.1 Introduction to Plotting

To make the plots, Maxima can use an external plotting package or its own graphical interface Xmaxima (see the section on `Plotting Formats`). The plotting functions calculate a set of points and pass them to the plotting package together with a set of commands specific to that graphic program. In some cases those commands and data are saved in a file and the graphic program is executed giving it the name of that file to be parsed.

When a file is created, it will begiven the name `maxout_xxx.format`, where `xxx` is a number that is unique to every concurrently-running instance of Maxima and `format` is the name of the plotting format being used (`gnuplot`, `xmaxima`, `mgnuplot` or `geomview`).

There are commands to save the plot in a graphic format file, rather than showing it in the screen. The default name for that graphic file is `maxplot.extension`, where `extension` is the extension normally used for the kind of graphic file selected, but that name can also be specified by the user.

The `maxout_xxx.format` and `maxplot.extension` files are created in the directory specified by the system variable `maxima_tempdir`. That location can be changed by assigning to that variable (or to the environment variable `MAXIMA_TEMPDIR`) a string that represents a valid directory where Maxima can create new files. The output of the Maxima plotting command will be a list with the names of the file(s) created, including their complete path, or empty if no files are created. Those files should be deleted after the maxima session ends.

If the format used is either `gnuplot` or `xmaxima`, and the `maxout_xxx.gnuplot` or `maxout_xxx.xmaxima` was saved, `gnuplot` or `xmaxima` can be run, giving it the name of that file as argument, in order to view again a plot previously created in Maxima. Thus, when a Maxima plotting command fails, the format can be set to `gnuplot` or `xmaxima` and the plain-text file `maxout_xxx.gnuplot` (or `maxout_xxx.xmaxima`) can be inspected to look for the source of the problem.

The additional package draw provides functions similar to the ones described in this section with some extra features, but it only works with `gnuplot`. Note that some plotting options have the same name in both plotting packages, but their syntax and behavior is different. To view the documentation for a graphic option `opt`, type `?? opt` in order to choose the information for either of those two packages.

·

Categories: Plotting