plot a dataset
Customizing a Plot with Options
dataplot(Xr, Y, opts);
dataplot(Xr, Yr, Z, opts);
dataplot(data, plottype, opts);
an rtable or list representing x-values or a range
an rtable or list representing y-values
an rtable or list representing y-values or a range
an rtable or list of lists representing z-values
a TimeSeries object or dataset reference
an rtable, list, or set representing one or more datasets, a DataSeries or a DataFrame
(optional) a string indicating the type of plot desired
(optional) arguments as described in the Options section
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.
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 (2-D plots) and plot3d/options (3-D plots) help pages can be used, where applicable.
animation : create an animation
colorpalette : the color palette used for default colors
transpose : transpose the data
The dataplot command plots numerical data provided in an rtable (Vector, Matrix, or Array), a list, a TimeSeries object, or a dataset reference.
2-D point plots: The first calling sequence plots a single collection of x-values against one or more collections of y-values. Alternatively, the first argument Xr can be a range a..b, indicating that the x-values are equally distributed over this range.
3-D surfaces: The second calling sequence plots a surface given by an m by n grid of z-values, Z. The first and second arguments, Xr and Yr, specify the x- and y-values respectively that correspond to each dimension of the grid. If either of these arguments is a range a..b, then the x- or y-values 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. 2-D point plots and 3-D 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.
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. 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 2-D Array.
For brevity, the remainder of this help page refers to 1-D, 2-D 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 1-D Array of length n can be used to hold a single one-dimensional dataset containing n values.
A 2-D m-by-n Array can be used to hold any of the following:
m one-dimensional datasets containing n values each,
m points of n coordinates each (for n equal to 2 or 3), or
a two-dimensional grid of values.
A 3-D m-by-n-by-p Array can be used to hold p two-dimensional 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 4-dimensional 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 2-D Arrays only. If you provide a 2-by-m or 3-by-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.
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".)
values -- point plot of given values (plots:-pointplot)
points -- point plot where data represents x,y coordinates (plots:-pointplot)
areachartstacked -- stacked area chart (Statistics:-AreaChart)
bar -- bar chart (Statistics:-ColumnGraph)
barhorizontal -- bar chart with horizontal bars (Statistics:-BarChart)
box -- box plot (Statistics:-BoxPlot)
cumulativesum -- cumulative sum chart (Statistics:-CumulativeSumChart)
density -- density plot (plots:-densityplot)
contour -- contour plot (plots:-contourplot)
heatmap -- heatmap (Statistics:-HeatMap)
histogram -- histogram (Statistics:-Histogram)
piechart -- piechart (Statistics:-PieChart)
treemap -- treemap (Statistics:-TreeMap)
points -- point plot where data represents x,y,z coordinates (plots:-pointplot3d)
surface -- surface generated from z values (plots:-surfdata)
mesh -- surface generated from x,y,z values (plots:-surfdata)
areachart -- area chart (Statistics:-AreaChart)
contour3d -- contour plot (plots:-contourplot3d)
piechart3d -- piechart (Statistics:-PieChart)
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 1-D Array, then a values plot is assumed. 2-D Arrays are interpreted as multiple values plots. 3-D Arrays are assumed to be multiple surface plots.
General Plotting Options and Command-Specific 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 2-D 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 2-D Point Plots
Automatic assignment of colors or symbols is available for 2-D 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.
2-D Point Plots
The first calling sequence allows you to plot x-values against y-values. Note that the examples in this section show how a variety of data types (lists, Vectors, Matrices, and Arrays) can be used.
Create an animation of the plot above.
Use a different range of x-values.
Use the fourth calling sequence to generate 2-D point plots.
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.
Use the colorscheme and colorpalette options to further customize the colors.
Use additional plotting options to change the look of the plot.
3-D Surface Plots
A surface plot can be generated with the second calling sequence by specifying the ranges of the x-values and y-values, and the grid of z-values.
Either of the first two arguments can be replaced by a Vector, list, or 1-D Array of values. Each value specifies the x- or y-coordinate corresponding to a row or column of z-values in the Matrix M.
You can also use the fourth calling sequence to generate the same plot. This calling sequence requires just the z-values 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 y-values for a sequence of curves.
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.
A mesh plot requires specification of x-, y- and z-values for m by n points.
Datasets and TimeSeries objects can also be plotted.
The dataplot command was introduced in Maple 2015.
For more information on Maple 2015 changes, see Updates in Maple 2015.
Download Help Document
What kind of issue would you like to report? (Optional)