AreaChart - Maple Help

Statistics

 AreaChart
 create area charts from data

 Calling Sequence AreaChart(X, options, plotoptions) AreaChart['interactive'](X)

Parameters

 X - data options - (optional) equation(s) of the form option=value where option is one of color, format, markers, orientation, scale, or xcoords; specify options for generating the area chart plotoptions - options to be passed to the plots[display] command

Description

 • The AreaChart command generates an area chart for the specified data. Several formats are available for multiple data sets: default, stacked and percent stacked. See format option below for more information.
 • The first parameter X is either a single data sample - given as e.g. a Vector - or a list of data samples. Note that the individual samples may be of variable size.
 • If the ['interactive'] option is used, then a dialog box appears that allows for customized creation of the plot.

Options

 The options argument can contain one or more of the options shown below. All unrecognized options will be passed to the plots[display] command. See the plot/options and plot3d/options help pages for details.
 • color=name, list, or range
 This option specifies colors for the individual data sets.  When a list of colors is given, each of the areas is colored with the corresponding color in the list. If a range of colors is given, the colors are generated by selecting an appropriate number of equally spaced points in the corresponding hue range.
 • format=default or stacked
 By default, individual data sets are displayed side-by-side as 3-D polygons. A stacked area chart shows related data groups, one on top of the other. A percent area chart is similar to a stacked area chart, except that it is rescaled to a height of 1 while preserving proportionality. If scale is set to relative and format is set to stacked then a percent stacked is generated.
 • markers=true or false
 This option specifies whether the original data points appear on the plot. The default value is true.
 • orientation=vertical or horizontal
 This option specifies whether the vertical or the horizontal layout is used. The default value is vertical.
 • scale=absolute or relative
 This option controls whether the absolute or relative data scale is used. If scale is set to relative and format is set to default then all data samples are rescaled so that their range belongs to an interval between -1 and 1. If scale is set to relative and format is set to stacked then a percent stacked plot is generated.
 • xcoords=default, list
 This option specifies the x-coordinates of the data points. By default, the x-coordinates of the points are 1, 2, 3, ...

Examples

 > $\mathrm{with}\left(\mathrm{Statistics}\right):$
 > $A≔⟨1,2,3,4,2,3,1⟩:$
 > $B≔⟨1,5,1,0,2,1,1⟩:$
 > $C≔⟨1,2,1,3,1,4,2⟩:$

The command to create the plot from the Plotting Guide using the above data is

 > $\mathrm{AreaChart}\left(\left[A,B,C\right]\right)$

Plot options such as background color or gridlines are passed to the plots:-display command:

 > $\mathrm{AreaChart}\left(\left[A,B,C\right],\mathrm{format}=\mathrm{stacked},\mathrm{gridlines}=\mathrm{true},\mathrm{background}="LightGrey"\right)$

The AreaChart command also accepts a Matrix. The columns are understood as individual data samples.

 > $M≔⟨A|B|C⟩$
 $\left[\begin{array}{rrr}1& 1& 1\\ 2& 5& 2\\ 3& 1& 1\\ 4& 0& 3\\ 2& 2& 1\\ 3& 1& 4\\ 1& 1& 2\end{array}\right]$ (1)
 > $\mathrm{AreaChart}\left(M\right)$

The command to create the plot from the Plotting Guide using the above data is

 > $\mathrm{AreaChart}\left(M,\mathrm{format}=\mathrm{stacked},\mathrm{scale}=\mathrm{relative},\mathrm{color}="Maroon".."Goldenrod",\mathrm{title}="Percent Stacked Area Chart"\right)$
 > $A≔⟨5,2,5,8,4,5,10,5⟩:$
 > $\mathrm{AreaChart}\left(A,\mathrm{color}="Blue",\mathrm{transparency}=0.5,\mathrm{thickness}=3,\mathrm{symbol}=\mathrm{solidcircle},\mathrm{symbolsize}=15,\mathrm{legend}=\left["Data Set A"\right]\right)$

There are several example datasets in Maple's data directory that can be read in using the Import command:

 > $\mathrm{data}≔\mathrm{Import}\left("datasets/air_passengers.csv",\mathrm{base}=\mathrm{datadir},\mathrm{output}=\mathrm{Matrix}\right)\left[2..,2\right]$
 ${{\mathrm{_rtable}}}_{{36893628217752328060}}$ (2)
 > $\mathrm{p1}≔\mathrm{AreaChart}\left(\mathrm{data},\mathrm{transparency}=0.3,\mathrm{symbolsize}=10,\mathrm{symbol}=\mathrm{solidbox},\mathrm{font}=\left["Calibri",16\right],\mathrm{tickmarks}=\left[\mathrm{default},\left[0,300,600\right]\right],\mathrm{size}=\left[800,"golden"\right]\right)$

The following adds a line showing the mean value for the data:

 > $\mathrm{plots}:-\mathrm{display}\left(\left[\mathrm{p1},\mathrm{plot}\left(\mathrm{Mean}\left(\mathrm{data}\right),0..\mathrm{numelems}\left(\mathrm{data}\right),\mathrm{linestyle}=\mathrm{dot},\mathrm{color}="Red",\mathrm{legend}="Mean"\right)\right]\right)$
 >