# Maple programs for plotting xrk output

This section provides examples for using the Maple program dataplot for plotting xrk snapshot files. Unless you have Maple on your system, this section will probably not be very useful to you. If you don't have Maple, it should be possible to accomplish the same things using programs like Mathematica, MATLAB, or even gnuplot. The section on file formats should provide the information you need.

## Two dimensional plots

The Maple program dataplot can be used with *.snap files generated by xrk to produce two dimensional plots of solution components versus t, or to plot any two components against each other.

The following example assumes that you generated the file text.snap during the tutorial and that this file is in the Linear subdirectory. To start the example, use cd to get into the Linear directory. Then start up Maple with the command

`xmaple &`
When the Maple window comes up, make it your active window and then type the following command to read in the dataplot program.
`readlib(dataplot);`
The above command assumes that Maple is set up to find the dataplot program. If the above command generates an error, then you need to get a copy of the .mapleinit file.

Once you have successfully read the dataplot program into Maple, the following command will plot the first component of the solution against time.

`dataplot(`test.snap`,1,2);`
The three mandatory arguments to dataplot are the name of the file containing the data, the column in the file to be used as the independent variable, and the column to be used as the dependent variable. Note that the name of the file should be enclosed in back-quotes, so that it is correctly translated by Maple to a Unix file name. The xrk program always saves the values of t in the first column, with the components of the solution in successive columns. To plot the second component, use the following command.
`dataplot(`test.snap`,1,3);`
To get a parametric plot of both solution components, use the following command.
`dataplot(`test.snap`,2,3);`

The dataplot command will also accept any optional arguments that the plot command uses. To learn more about dataplot, look at the help with the standard Maple syntax

`?dataplot`

Enhancements to graphs, like adding axis labels, titles, and legends can be done using the textplot and display routines in the standard Maple plots package.