Mapping of model outputs to observed data
Super class
ospsuite.utils::Printable
-> DataMapping
Public fields
log
String defining which axis will be plotted in logarithmic scaling. Possible values are "" (empty string, both axis in linear scaling, default), "x", "y", "xy" (both axis are in logarithmic scaling).
title
Title of the plot. If the value is an empty string, no title is added. Otherwise, the title appears on top of the plot.
addLegend
Boolean defining if the legend should be added to the plot. If TRUE, a legend will be added for each group and each XYSeries that is not in any group
legendPosition
Position of the legend in the plot. Default value is "topright". See
legend()
for more information.
Active bindings
xySeries
Named list with the
XYData
that will be plotted. Names are the labels of thexySeries
objectsxySeriesCount
number of
XYData
objects to be plottedxLim
Limits of the x-axis. Numerical vector c(min, max)
yLim
Limits of the y-axis. Numerical vector c(min, max)
xLab
label of the x-axis.
yLab
label of the y-axis.
xDimension
Dimension of x values. See enum
ospDimensions
for the list of supported dimensions. If no dimension is specified, the dimension of the first addedXYSeries
is used. If noXYSeries
are present, the dimension isNULL
When changing the dimension, the unit is automatically set to the base unit of the dimension.yDimension
Dimension of y values. See enum
ospDimensions
for the list of supported dimensions. If no dimension is specified, the dimension of the first addedXYSeries
is used. If noXYSeries
are present, the dimension isNULL
#' When changing the dimension, the unit is automatically set to the base unit of the dimension.xUnit
Unit of x values. If no unit is specified, the default unit of the dimension is used. If no dimension is specified, the unit is
NULL
yUnit
Unit of y values. If no unit is specified, the default unit of the dimension is used. If no dimension is specified, the unit is
NULL
groupings
A named list listing which data sets are grouped together. Grouped data sets will be plotted with the same color and used together in the legend.
ungroupedSeries
A list of
XYData
that do not belong to any group.NULL
if empty.plotType
A string defining what kind of plot is generated when the
plot()
method of the object is called. Supported plot types are listed in the enumPlotTypes
. Default is "IndividualProfile"populationQuantiles
A numerical vector with three quantile values used if
plotType = "PopulationQuantiles"
. Default isc(0.05, 0.5, 0.95)
Methods
Inherited methods
Method addModelOutputs()
Add simulated results to the data mapping
Add new ModelOutput
to be plotted. Line type is set to "l" (line) by default.
Usage
DataMapping$addModelOutputs(
paths,
labels,
simulationResults,
groups = NULL,
removeNA = TRUE
)
Arguments
paths
A string or a list of strings representing the path(s) to the output(s) in the model.
labels
A string or a list of strings that are used as a label (e.g. in the legend) for the output(s). If
NULL
(default), the path of the output is used as a label.simulationResults
Simulated results as returned by
runSimulation
groups
A string or a list of strings assigning the outputs to a group. All outputs may be assigned to one group, or to different groups, while each output can be assigned to not more than one group. If an entry within the list is NULL, the corresponding output is not assigned to any group
removeNA
If TRUE (default), NA values will be removed from the simulated results. NA values can be the result of observer not being calculated at a certain time point.
Method addXYSeries()
Add XYData
object(s).
Arguments
xValsList
A single array or a list of arrays of x-values. For time series, the values must be in minutes.
yValsList
A single array or a list of arrays of y-values.
labels
A string or a list of strings that are used as unique label for the output(s). Must be of same length as
xValsList
.yErrorList
A single array or a list of arrays of y-error values. If
NULL
(default), no errors are assigned. If notNULL
, the list must have the same number of entries (numerical arrays) asyValsList
. If an entry of the list isNULL
, the respective data set has no error.groups
A string or a list of strings assigning the data set to a group. If an entry within the list is
NULL
, the corresponding data set is not assigned to any group. IfNULL
(default), all data sets are not assigned to any group. If provided,groups
must have the same length asxValsList
Details
Add new series of x-y values to be plotted. If an XYData
with the same label already exists,
it will be overwritten
Examples
dataMapping <- DataMapping$new()
xVals <- list(c(1, 2, 3, 4), c(1, 2, 3, 4), c(2, 3, 4, 5))
yVals <- list(c(5, 6, 7, 8), c(5, 6, 7, 8), c(6, 7, 8, 9))
yErr <- list(c(0.1, 0.1, 0.1, 0.2), NULL, c(0.2, 0.3, 0.1, 0.2))
groups <- list("Group1", NULL, "Group1")
dataMapping$addXYSeries(xValsList = xVals, yValsList = yVals,
yErrorList = yErr, labels = list("my series1", "my series2", "my series3"), groups = groups)
Method addXYData()
Add XYData
object(s). The objects are cloned at adding.
Arguments
XYData
Object or a list of objects of the type
XYData
groups
A string or a list of strings assigning the data set to a group. If an entry within the list is
NULL
, the corresponding data set is not assigned to any group. IfNULL
(default), all data sets are not assigned to any group. If provided,groups
must have the same length asXYData
output is not assigned to any group
Method addDataSets()
Add DataSet
object(s).
Arguments
dataSets
Object or a list of objects of the type
DataSet
groups
A string or a list of strings assigning the data set to a group. If an entry within the list is
NULL
, the corresponding data set is not assigned to any group. IfNULL
(default), all data sets are not assigned to any group. If provided,groups
must have the same length asdataSets
output is not assigned to any group
Method getXYSeriesGroupMap()
Return group mapping of labels.
Method setXFactors()
Set the X-factors of x-y values by labels.
Method setYFactors()
Set the y-factors of x-y values by labels.
Method setXOffsets()
Set the X-offset of x-y values by labels.
Method setYOffsets()
Set the Y-offset of x-y values by labels.
Method setLinetypes()
Set the line type(s) property of the data to be plotted. Line types as accepted by the base plot
lty argument.
Details
If no data set for the provided label is present in the mapping, the corresponding value is ignored.
No check is performed whether a valid type is provided.Line types as accepted by the base plot
lty argument.
Line types can be provided either as numeric or as character vectors (e.g. "dashed").
Method setColors()
Set the colors of the data to be plotted
Method plot()
Plot the data stored in this DataMapping
.
Arguments
...
Any parameter that can be interpreted by the default
plot()
function
Method print()
Print the object to the console
Examples
## ------------------------------------------------
## Method `DataMapping$addXYSeries`
## ------------------------------------------------
dataMapping <- DataMapping$new()
xVals <- list(c(1, 2, 3, 4), c(1, 2, 3, 4), c(2, 3, 4, 5))
yVals <- list(c(5, 6, 7, 8), c(5, 6, 7, 8), c(6, 7, 8, 9))
yErr <- list(c(0.1, 0.1, 0.1, 0.2), NULL, c(0.2, 0.3, 0.1, 0.2))
groups <- list("Group1", NULL, "Group1")
dataMapping$addXYSeries(xValsList = xVals, yValsList = yVals,
yErrorList = yErr, labels = list("my series1", "my series2", "my series3"), groups = groups)