Plotting Functions and Data in Maple
Topics covered in this chapter are:
2.1 Simple 2D Plots of one or more Functions
2.2 Entering Numerical Data for Plotting
2.3 Plots in 3D
2.4 Printing the Plot Windows
As help for the plot command says, the basic form for creating a two dimensional plot is:
where the first argument gives one or more functions to be plotted and the second argument gives the range of the independent function. You can also give a third argument to restrict the vertical range as well the horizontal. Here is a typical example:
A plot showing two functions at the same time may be formed by:
Note the use of brackets to enclose the two functions and the third argument used to limit the vertical range.
2.2 Entering Numerical Data for Plotting
Numeric data in arrays may be plotted with the same plot command. Two different data structures are accepted, but neither is very convenient if you start with x data in one vector and y data in a second vector. The required form for the data is as:
a list of points : [[x1, y1], [x2, y2], ...[xn,yn]]Here is an example of plotting the following data:
A program called yxplot makes it much easier to plot one vector against another one. It is modeled after the Matlab program of the same name and must be loaded before it can be used. To load and try the Maple version of yxplot:
Use the read command:
The program has not really been executed, but it now ready to be run with data that you want to show. In most of the examples in the notes, the read command to input programs.
To continue with our same example, we might put the data in two separate lists:
For more information on arrays or plot, see the on-line help.
In 3D plotting, a 25 by 25 grid (generating 625 points) is the default. If a different number of points is desired, the plot3d option grid = [m,n] may be used. Here m and n must be positive integers. If more than one function is to be plotted, each function will be plotted at m by n points.
Unlike two-dimensional plots, three-dimensional plots allow more interaction after the plot has been displayed. Changes can be made to graph via the menu bar on Maple Vr4. The menu allows the user to change the color, the axes, the projection, and other things about the three-dimensional plot. The 3D plot can be rotated to the user's preference by simply clicking on the plot and holding the left mouse button down. The plot is replaced by an outline box as the plot is rotated. In order to redraw the plot at the chosen viewpoint, simply double-click on the plot.
For more information on using plot3d type, see the on-line help. With all its plotting versatility, there are still some tasks which Maple does not at present seem to be able to accomplish. For example, it is unable to plot functions with overlapping but non-identical ranges in x.
It is probably easiest in a Unix system to create a postscript file of your plots and then print them on your usual laser printer.