plot multiple timeseries on time axis
stackedplot // demo stackedplot(ts) stackedplot(ts1, ..., tsN) stackedplot(..., vars) stackedplot(..., LineSpec) stackedplot(..., LineSpec, GlobalProperty) stackedplot(..., "CombineMatchingNames", %f) stackedplot(..., Name, Value) f = stackedplot(..)
timeseries object
strings vector containing to variables names of timeseries
column index vector corresponding to position in variables names timeseries
cell of strings: each element can contain one or multiple variables names.
This optional argument must be a string that will be used as a
shortcut to specify a way of drawing a line. We can have one
LineSpec
per y
or {x,y}
previously entered. LineSpec
options deals with
LineStyle, Marker and Color specifiers (see LineSpec).
Those specifiers determine the line style, mark style and color of
the plotted lines.
This optional argument represents a sequence of couple
statements {PropertyName,PropertyValue}
that defines
global objects properties applied to all the curves created by this
plot. For a complete view of the available properties (see
GlobalProperty).
'Title': string that contains the title of plot.
'DisplayLabels': matrix of strings that contains the names of Y-label for each axe. Default value: variables names of timeseries
'LegendLabels': matrix of strings that contains the names of timeseries.
handle of the created figure.
The stackedplot function plots the variables of timeseries on the same time basis (x-axis). All timeseries must have the same time basis. If two or more timeseries have common variables, their curves will be in the same graph. By specifying CombineMatchingNames to %f, there will be one graph per variable for each timeseries.
stackeplot(..., vars) plots only variables of timeseries specified by vars. vars can be
a vector of strings containing variables names to plot.
a vector of indexes ccorresponding to position of variables names in timeseries.
a cell containing variable names in matrices to plot them in same graphs. ie: {"var1", ["var2", "var3"]} will display var1 in a graph and var2 and var3 in another one.
stackedplot(..., LineSpec, GlobalProperty) customizes the line style, marker or color of polylines. This arguments are the same as the plot function.
stackedplot(..., "Title", str) adds a plot title.
stackedplot(..., "DisplayLabels", str) specifies the labels for the y-axis.
stackedplot(..., "LegendLabels", str) adds a legend for each plot. str is a vector of size N timeseries input. The legend can be used to specify the name of timeseries.
Enter the command stackedplot
to see a demo.
stackedplot(ts)
n = 100; t = datetime(2000, 1, 1) + caldays(1:n)'; y = floor(10 * rand(n, 3)) + 10; ts = timeseries(t, y(:, 1), y(:, 2), y(:, 3), "VariableNames", ["Time", "Var 1", "Var 2", "Var3"]); stackedplot(ts); | ![]() | ![]() |
stackedplot(ts1, ts2)
n = 100; t = seconds(1:n)'; y1 = floor(10 * rand(n, 3)) + 10; ts1 = timeseries(t, y1(:, 1), y1(:, 2), y1(:, 3), "VariableNames", ["Time", "Var 1", "Var 2", "Var3"]); y2 = floor(10 * rand(n, 2)) + 20; ts2 = timeseries(t, y2(:, 1), y2(:, 2), "VariableNames", ["Time", "Var 1", "Var 2"]); stackedplot(ts1, ts2); | ![]() | ![]() |
stackedplot(ts1, ts2, "CombineMatchingNames", %f)
t = datetime(2022, 1, 1):datetime(2022, 8, 31); n = size(t, "*"); y1 = floor(10 * rand(n, 2)) + 10; ts1 = timeseries(t, y1(:, 1), y1(:, 2), "VariableNames", ["Time", "Result_1", "Result_2"]); y2 = floor(10 * rand(n, 2)) + 20; ts2 = timeseries(t, y2(:, 1), y2(:, 2), "VariableNames", ["Time", "Result_1", "Result_2"]); stackedplot(ts1, ts2); stackedplot(ts1, ts2, "CombineMatchingNames", %f); | ![]() | ![]() |
stackedplot(ts1, ts2, vars)
t = datetime(2022, 1, 1):datetime(2022, 8, 31); n = size(t, "*"); y1 = floor(10 * rand(n, 3)) + 10; ts1 = timeseries(t, y1(:, 1), y1(:, 2), y1(:, 3), "VariableNames", ["Time", "Result_1", "Result_2", "Result_3"]); y2 = floor(10 * rand(n, 3)) + 20; ts2 = timeseries(t, y2(:, 1), y2(:, 2), y2(:, 3), "VariableNames", ["Time", "Result_1", "Result_2", "Result_3"]); stackedplot(ts1, ts2, ["Result_1", "Result_3"]); stackedplot(ts1, ts2, [1 3]); stackedplot(ts1, ts2, {"Result_1", ["Result_2", "Result_3"]}); | ![]() | ![]() |
stackedplot(ts1, ts2, "LegendLabels", str, "DisplayLabels", str2)
t = datetime(2022, 1, 1):datetime(2022, 8, 31); n = size(t, "*"); y1 = floor(10 * rand(n, 3)) + 10; ts1 = timeseries(t, y1(:, 1), y1(:, 2), y1(:,3), "VariableNames", ["Time", "Result_1", "Result_2", "Result_3"]); y2 = floor(10 * rand(n, 3)) + 20; ts2 = timeseries(t, y2(:, 1), y2(:, 2), y2(:, 3), "VariableNames", ["Time", "Result_1", "Result_2", "Result_3"]); stackedplot(ts1, ts2, {"Result_1", ["Result_2", "Result_3"]}, "LegendLabels", ["t1", "t2"], "DisplayLabels", ["res1", "res2 - res3"]); | ![]() | ![]() |
Version | Description |
2024.0.0 | Introduction in Scilab. |