
Calling Sequence


dataplot(Xr, Y, opts);
dataplot(Xr, Yr, Z, opts);
dataplot(tsdata, opts);
dataplot(data, plottype, opts);


Parameters


Xr



an rtable or list representing xvalues or a range

Y



an rtable or list representing yvalues

Yr



an rtable or list representing yvalues or a range

Z



an rtable or list of lists representing zvalues

tsdata



a TimeSeries object or dataset reference

data



an rtable, list, or set representing one or more datasets, a DataSeries or a DataFrame

plottype



(optional) a string indicating the type of plot desired

opts



(optional) arguments as described in the Options section





Summary


•

The dataplot command accepts numerical data and returns a plot. Different kinds of plots, such as point plots, contour plots or surfaces, can be generated.



Options



The opts argument shown in the Calling Sequence section above consists of a sequence of one or more plotting options. These can be one of the options listed below, which are described in more detail in the "Description" section. In addition, the options described on the plot/options (2D plots) and plot3d/options (3D plots) help pages can be used, where applicable.

•

animation : create an animation

•

colorpalette : the color palette used for default colors

•

transpose : transpose the data



Description


•

2D point plots: The first calling sequence plots a single collection of xvalues against one or more collections of yvalues. Alternatively, the first argument Xr can be a range a..b, indicating that the xvalues are equally distributed over this range.

•

3D surfaces: The second calling sequence plots a surface given by an $m$ by $n$ grid of zvalues, Z. The first and second arguments, Xr and Yr, specify the x and yvalues respectively that correspond to each dimension of the grid. If either of these arguments is a range a..b, then the x or yvalues are assumed to be equally distributed over this range.

•

Time series: The third calling sequence plots a TimeSeries object (created by the TimeSeriesAnalysis:TimeSeries command) or a dataset (see DataSets/Reference). If one of these datasets is detected, then the TimeSeriesPlot command is called. The remaining information on this help page regarding data formats and plotting options are generally not applicable in this case. Instead, see the TimeSeriesAnalysis:TimeSeriesPlot help page for a description of the options that can be used with this calling sequence..

•

Other types of data plots: The final calling sequence plots one or more datasets contained in a single rtable, list or set, a DataSeries or a DataFrame. A plot type can be specified. Otherwise, a plot type is assumed based on the data provided. A large number of plot types are available. 2D point plots and 3D surfaces can alternatively be generated with this calling sequence instead of the first and second ones.

•

Various attributes of the plot, such as color, line thickness or title, may be specified as described in the following sections.

•

For greatest efficiency, provide data as rtables of datatype float[8].



Data Format


•

Data is accepted as rtables (Arrays, Vectors, or Matrices) or lists. DataSeries and DataFrames are also accepted. If the underlying plotting command accepts these structures, then they are passed directly and otherwise they are converted to rtables first and processed as described below.

•

The input data is standardized and saved as single rtables with datatype float[8]. To minimize the number of conversions needed, it is recommended that you provide your data in this form. For example, a list consisting of three Vectors will be converted to a 2D Array.

•

For brevity, the remainder of this help page refers to 1D, 2D or higher dimensional Arrays. It should be understood that, in general, any of the equivalent Vector, Matrix, or list forms can be provided in the place of an Array.

•

A 1D Array of length $n$ can be used to hold a single onedimensional dataset containing $n$ values.

•

A 2D $m$by$n$ Array can be used to hold any of the following:

–

$m$ onedimensional datasets containing $n$ values each,

–

$m$ points of $n$ coordinates each (for $n$ equal to 2 or 3), or

–

a twodimensional grid of values.

•

A 3D $m$by$n$by$p$ Array can be used to hold $p$ twodimensional grids. Such an Array, with $p$ equal to 3 can also be used to hold a single dataset for a mesh plot, described later.

•

Arrays with more than 4 dimensions are not accepted, with one exception. A 4dimensional Array with third dimension equal to 1..3 is interpreted as multiple mesh datasets.

•

If you provide a list of Arrays (or their equivalent) with varying dimensions, then these will be converted to a single Array large enough to hold all the data. Any missing values will be set to Float(undefined), which in most cases, will be ignored when the plot is created.

•

If the transpose option is provided, then the transpose of the data is computed and used for plotting. This option is applicable to 2D Arrays only. If you provide a 2by$m$ or 3by$m$ Array, and the plot type points when using the fourth calling sequence, then the Array is automatically transposed, with the assumption that you had meant to provide the coordinate values of $m$ points. This default action can be suppressed by supplying the transpose=false option.



Plot Types


•

The optional parameter plottype can take any of the following values listed as follows. For each value, the underlying command used to generate the plot is included in brackets. Refer to these commands' help pages to see additional options that can be used. (See the following section on "Customizing a Plot with Options".)

–

points  point plot where data represents $x,y$ coordinates (plots:pointplot)

•

Most of these plot types can accommodate multiple datasets. The ones that can accept a single dataset only are: density, contour, contour3d, heatmap, histogram, piechart, piechart3d, and treemap.

•

Default plot types: If a plot type is not specified, then default plots are produced. If the input is a 1D Array, then a values plot is assumed. 2D Arrays are interpreted as multiple values plots. 3D Arrays are assumed to be multiple surface plots.



Customizing a Plot with Options



General Plotting Options and CommandSpecific Options


•

Most of the plotting options described on the plot/option and plot3d/option help pages can be used with the dataplot command when applicable. For example, a title can be added with the title option, or the line or surface style can be changed with the style option. In particular, use style=point to display data as points only.

•

If you are displaying multiple datasets in a single plot, then options that can be applied to an individual dataset (such as color or symbolsize, but not caption) can take a list of values. For example, if you have three datasets, then the color=["Blue", "Yellow", "Orange"] can be used. Note that the multiple datasets should be provided as a list rather than a set, since ordering in a set is not preserved.

•

Automatic assignment of colors and symbols are available for 2D point plots and are described in the following section. For other plots, the default colors and symbols are chosen by the underlying commands used to create the plots.

•

Options that are applicable only to the underlying command may be provided. For example, the bincount option, as described on the Statistics:Histogram help page, may be provided if the plot type is histogram.

•

You can generate an animation of a point plot using the animation option. This is available only with the first calling sequence or with the fourth calling sequence and a plot type of points or values.



Automatic Color and Symbol Choices for 2D Point Plots


•

Automatic assignment of colors or symbols is available for 2D point plots. If multiple datasets are given, then colors from the default color palette are assigned to each dataset.

•

The default color palette can be changed with the colorpalette option. See the plot/color help page for more information about color palettes. Default colors and symbols can always be overridden by using the color and symbol options as described on the plot/option help page.

•

If a single color is requested with the color option or the colorscheme option is provided, then different symbols are assigned to each dataset.

•

The colorscheme option causes a single curve or set of points to be colored according to a given scheme; it does not cause colors to be distributed over multiple datasets. In most cases, the colorscheme option overrides the color option.




Examples



2D Point Plots


•

The first calling sequence allows you to plot xvalues against yvalues. Note that the examples in this section show how a variety of data types (lists, Vectors, Matrices, and Arrays) can be used.

>

X := Vector([1, 2, 4, 7, 10, 12], datatype=float[8]):

>

Y1 := Vector([1, 2.5, 5, 6, 8, 7], datatype=float[8]):

>

Y2 := Vector([2, 4, 6, 9, 10, 12], datatype=float[8]):

>

Y3 := Vector([4, 5, 7, 9.5, 11, 13.5], datatype=float[8]):

>

dataplot(X, [Y1, Y2, Y3]);

•

Create an animation of the plot above.

>

dataplot(X, [Y1, Y2, Y3], animation);

•

Use a different range of xvalues.

>

dataplot(10..60, [Y1, Y2, Y3]);

•

Use the fourth calling sequence to generate 2D point plots.

>

dataplot([Y1, Y2], "points");

•

Assign a single color to all curves. In this case, different symbols will be assigned to each dataset. Include the symbol option if you want to override this behavior.

>

dataplot(Y4, color="Niagara Purple", symbolsize=25);

>

dataplot(Y4, color="Niagara Purple", symbol=solidbox);

•

Use the colorscheme and colorpalette options to further customize the colors.

>

dataplot(Y4, colorscheme=["Blue", "Red", "Orange"]);

>

dataplot(Y4, colorpalette="dalton");

•

Use additional plotting options to change the look of the plot.

>

dataplot(Y4, style=point, axes=boxed);



3D Surface Plots


•

A surface plot can be generated with the second calling sequence by specifying the ranges of the xvalues and yvalues, and the grid of zvalues.

>

M := Matrix(25, 25, (i,j)>(i13)^2(j13)^2, datatype=float[8]);

${{\mathrm{\_rtable}}}_{{18446883778971113342}}$
 (1) 
>

dataplot(0..5, 0..5, M);

•

Either of the first two arguments can be replaced by a Vector, list, or 1D Array of values. Each value specifies the x or ycoordinate corresponding to a row or column of zvalues in the Matrix M.

>

V := Vector(25, i>i^2, datatype=float[8]):

•

You can also use the fourth calling sequence to generate the same plot. This calling sequence requires just the zvalues and assumes the x and y ranges are 0..1. Make sure you add the plot type argument, surface. Otherwise, the Matrix will be assumed to contain the yvalues for a sequence of curves.

>

dataplot(M, surface, colorscheme=["Teal", "Gray"]);



Other Plots


•

By specifying the plot type with the fourth calling sequence, a number of different plots can be generated. The following plots show the data values in Matrix M viewed in two different ways.

>

dataplot(M, contour3d, thickness=3);

•

A mesh plot requires specification of x, y and zvalues for $m$ by $n$ points.

>

A := Array(1..7, 1..3, 1..3, [[[0., 0., 0.], [.500, 0., .500], [1., 0., 1.]], [[0., 0., 0.], [.250, .433, .500], [.500, .866, 1.]], [[0., 0., 0.], [.250, .433, .500], [.500, .866, 1.]], [[0., 0., 0.], [.500, 0., .500], [1., 0., 1.]], [[0., 0., 0.], [.250, .433, .500], [.500, .866, 1.]], [[0., 0., 0.], [.250, .433, .500], [.500, .866, 1.]], [[0., 0., 0.], [.500, 0., .500], [1., 0., 1.]]], datatype=float[8]):

•

Datasets and TimeSeries objects can also be plotted.

>

ref := DataSets:Quandl:Reference("ODA/CAN_LP"):




Compatibility


•

The dataplot command was introduced in Maple 2015.



