display time series data - Maple Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Statistics : Time Series Analysis Package : TimeSeriesAnalysis/TimeSeriesPlot

TimeSeriesAnalysis[TimeSeriesPlot] - display time series data

Calling Sequence


TimeSeriesPlot(ts1, ts2, [ts3, opt1, opt2], ts4, opt3, opt4)


ts1, ts2, ts3, ts4


TimeSeries objects

opt1, opt2, opt3, opt4


plot options of the form optionname = value; options not inside lists such as opt3 and opt4 can also have the form split = value (see below)



The TimeSeriesPlot command is used for visualizing time series data. It can show multiple data sets of different time series with one invocation, possibly with different plot options for different time series. Moreover, the data sets can be shown in a single plot or they can be split into multiple plots.


The first calling sequence above creates a plot with all data sets from a single time series in it, and default plot options.


The second calling sequence shows an example of how you can plot multiple time series. You do this by submitting a sequence consisting of time series and/or lists, in arbitrary order. If lists are included, then the first element of each such list should be a time series, and all other elements should be plot options: these plot options apply only to the time series in the list. In addition, more plot options can be given after all time series; these options apply to all time series. For example, to change the size of a plot, you can use the size option; the default used for time series plots is size=0.75,0.35. If an option is given both outside of lists and in a list with a time series, then for that time series the option specified in the list takes precedence.

Specifying colors


If you want all curves in the resulting plot to be the same color, you can use the color option as specified on the help page for plot options. Similarly, if you want all curves of a time series to be the same color, you can put that time series in a list and add the color option to that list.


You can also specify different colors as a list:


If you specify colors as a list for a color option occurring outside a list, the colors are applied to all data sets of all time series. In this case, the number of colors specified must be at least the number of data sets occurring in all time series given.


Alternatively, if you specify colors as a list for a color option included in a list with a time series, then the colors are applied to the data sets of this time series only. In this case, the number of colors specified must be at least the number of data sets occurring in the time series to which the option applies.


The TimeSeriesPlot command also supports using a range of colors for either all data sets in one time series, or all data sets processed by the command. This is done with the option color = C1 .. C2, where C1 and C2 are specifications of colors such that color = C1 and color = C2 are valid color options. Such an option can be applied to the whole command, or to an individual time series. This feature uses the ColorTools[Gradient] command.

The split option


The split option can be used to split the display of data sets into several plots, displayed as an array plot. There are several ways this can be specified:


split = separate


This option makes a separate plot in the plot array for each data set.


split = pertimeseries


This option makes a separate plot for each time series, containing all data sets from that time series.


split = together


This option makes a single plot containing all data sets from all time series.


split = automatic


This option behaves like split = together, except for time series resulting from the TimeSeriesAnalysis[Decomposition] command. Such time series are separated out from the rest and all their data sets get a separate plot.


split = [spec1, spec2, ...]


Using a list for the value of the split option, you can fully customize how the data sets are distributed over plots. Each item in the list is a specification for a single plot in the array plot that is generated. You can use several types of items in these lists:


The first possibility is a list [ts, is1, is2, ...] where the first element is one of the time series you have specified, and the subsequent elements are either positive integers or strings. These elements select data sets from the time series: a positive integer is1 selects the data set in the is1th column of ts; a string is2 selects the data set with header is2. The result is to select all of the data sets given by these integers and/or strings.


The second possibility is a time series ts. This selects all data sets from this time series; it is equivalent to the list [ts, 1, 2, ..., k], where k is the number of data sets in ts.


The final possibility is a set {e1, e2, ...}, where each of element is either a list or a time series as explained in the previous two bullet points; this represents all of the data sets selected by each of e1, e2, and so on.


An example would be TimeSeriesPlot(ts1, ts2, ts3, split = [ts1, [ts2, 2, 3], {[ts2, 1], ts3}]), where ts2 is a time series with at least three data sets. This would split the data sets into three plots: one for all data sets in ts1, one for the second and third data set in ts2, and one for the first data set in ts2 and all data sets in ts3.



A basic example.


ts1:=Time seriesA9 rows of data:2012-12-01 - 2013-08-01



Using plot options.


Because there is only one time series, in this case it would be the same to specify these plot options in a list together with the time series.


We add two more time series with several data sets.


ts2:=Time seriesB, C25 rows of data:2013-02-06 - 2013-07-24



ts3:=Time seriesD, E, F30 rows of data:2013-01-19 - 2013-08-10


By default, these time series will all be shown in a single plot.


Because the quantities differ by orders of magnitude, this is not particularly useful. It is better to split the data sets into two plots. All data sets in time series ts1 and ts2, and data set F from time series ts3, have smaller values, whereas data sets D and E from time series ts3 have larger values.


We can make it clearer which data set comes from which time series by specifying colors. We specify the colors for ts2 and ts3 explicitly for the given time series by including it in the list, and specify that all other time series (in this case ts1) are colored red by including a color option outside these lists.

For the split option, this time we use numbers to specify the data sets in ts3, to the same effect as using strings before.


Alternatively, we can specify all of the colors for all of the data sets in a single list.


We can split these three data sets into three plots, or group them per time series.



If a forecast and several confidence intervals are submitted, and the split option is not used (or equivalently, you use split = automatic), they are generally displayed in a single plot. An example follows.


ts3e:=Time seriesE30 rows of data:2013-01-19 - 2013-08-10



model:=< an ETS(A,N,N) model >



cis:=Time seriesE (forecast - 2 percentile), ..., E (forecast - 98 percentile)4 rows of data:2013-08-16 - 2013-09-06



A decomposition, however, is shown in separate plots by default.


dc:=Time seriesE (residuals), E (level)30 rows of data:2013-01-19 - 2013-08-10



To show the curves together, use split = together.


If we plot all these items together, the decomposition will be split out, but the other elements will be shown together.


See Also

TimeSeriesAnalysis, TimeSeriesAnalysis[SeasonalSubseriesPlot]

Download Help Document

Was this information helpful?

Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam