Maple Plot Options
Maple has very powerful plotting capabilities. It can plot points in the same way as Matlab, but it can also do adaptive plots of symbolic functions, in many different formats. We may (or may not) address these abilities elsewhere, but here we will discuss some options for enhancing ordinary plots.
Consider an ordinary plot of some data and a curve to pass through them.
plot([temppts, co[1]+co[2]*(x-temppts[1, 1])], x = temppts[1, 1] .. temppts[nyears, 1]);
which produces a plot that appears below.
This is not really what we want to see. We should change the data to some kind of points, thicken the line, label the axes, and make a title and a legend. First, we change the data so that they show in a point style.
plot([temppts, co[1]+co[2]*(x-temppts[1, 1])], x = temppts[1, 1] .. temppts[nyears, 1],style=[point,line]);
This is an example of the way that Maple handles plot options that apply to individual data series. One
puts such options in a an ordered list, so that there is a correspondence between the attributes
in the option and the data series listed in the first argument of plot. If there are muliple data
series but only one option attribute, then that attribute is applied to all data series.
If there are different numbers of data series and attributes, then the attributes cycle. The
command above produces this image.
We can change the symbol for the data points, as well as the size and color by adding the options
symbol = box, symbolsize = 5, color = [blue, RGB(.8, .5, .3)]. This produces
The default symbol size is 10. By setting the size to 5, we made the data point symbols smaller.
The symbols that are possible include asterisk, box, circle, cross, diagonalcross, diamond, point, solidbox, solidcircle, and
soliddiamond.
The default is diamond.
Since colors are attributes of data series, we can set them in an ordered list again. The first is a built-in
color blue, while for the second we specify our own color using the RGB() function.
RGB takes three arguments for the amount of red, green, and blue, respectively. The arguments are
numbers in the interval [0,1].
We can double the line thickness and make it dashed by adding the options thickness = 2, linestyle = dash. The default thickness is 1. The possible line styles include solid, dot, dash, dashdot, longdash, spacedash, and spacedot, with solid as the default.
Axis labels are added using an ordered list, this time indicating correspondence between the labels and the x and y axis in order. Finally we add a title and a legend, setting the location of the legend to the bottom, which is actually the default. The final plot command looks like this:
plot([temppts, co[1]+co[2]*(x-temppts[1, 1])], x = temppts[1, 1] .. temppts[nyears, 1], style = [point, line], \ symbol = box, symbolsize = 5, color = [blue, RGB(.8, .5, .3)], thickness = 2, linestyle = dash, \ labels = ["Year", "Temp."], title = "Temperature trends from 1995 to 2010", \ legend = ["Annual mean temp.", "Linear Fit"], legendstyle = [location = bottom]);
The result is shown below.
The last test will take place at the final exam time on
Tuesday, 12 December, from 1:30-3:30. It will be written as a one-hour (not
50 minute) exam, but you may have the full two hours for it.
In other respects it will be very like the other tests, but
comprehensive - it will emphasize Python, but cover all the
topics we have seen.
There is a
Sample Exam, but be aware that things will have changed somewhat
with the advent of ChatGPT.
Assignment A
is posted.