Mapping of model outputs to observed data
Super class
ospsuite.utils::Printable -> DataMapping
Public fields
logString 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).
titleTitle of the plot. If the value is an empty string, no title is added. Otherwise, the title appears on top of the plot.
addLegendBoolean 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
legendPositionPosition of the legend in the plot. Default value is "topright". See
legend()for more information.
Active bindings
xySeriesNamed list with the
XYDatathat will be plotted. Names are the labels of thexySeriesobjectsxySeriesCountnumber of
XYDataobjects to be plottedxLimLimits of the x-axis. Numerical vector c(min, max)
yLimLimits of the y-axis. Numerical vector c(min, max)
xLablabel of the x-axis.
yLablabel of the y-axis.
xDimensionDimension of x values. See enum
ospDimensionsfor the list of supported dimensions. If no dimension is specified, the dimension of the first addedXYSeriesis used. If noXYSeriesare present, the dimension isNULLWhen changing the dimension, the unit is automatically set to the base unit of the dimension.yDimensionDimension of y values. See enum
ospDimensionsfor the list of supported dimensions. If no dimension is specified, the dimension of the first addedXYSeriesis used. If noXYSeriesare present, the dimension isNULL#' When changing the dimension, the unit is automatically set to the base unit of the dimension.xUnitUnit of x values. If no unit is specified, the default unit of the dimension is used. If no dimension is specified, the unit is
NULLyUnitUnit of y values. If no unit is specified, the default unit of the dimension is used. If no dimension is specified, the unit is
NULLgroupingsA 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.
ungroupedSeriesA list of
XYDatathat do not belong to any group.NULLif empty.plotTypeA 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"populationQuantilesA 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
pathsA string or a list of strings representing the path(s) to the output(s) in the model.
labelsA 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.simulationResultsSimulated results as returned by
runSimulationgroupsA 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
removeNAIf 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
xValsListA single array or a list of arrays of x-values. For time series, the values must be in minutes.
yValsListA single array or a list of arrays of y-values.
labelsA string or a list of strings that are used as unique label for the output(s). Must be of same length as
xValsList.yErrorListA 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.groupsA 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,groupsmust 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
XYDataObject or a list of objects of the type
XYDatagroupsA 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,groupsmust have the same length asXYDataoutput is not assigned to any group
Method addDataSets()
Add DataSet object(s).
Arguments
dataSetsObject or a list of objects of the type
DataSetgroupsA 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,groupsmust have the same length asdataSetsoutput 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)