Plot R6 PM_final objects made by makeFinal and loaded as a field in the
PM_result object, e.g. PM_result$final.
Usage
# S3 method for PM_final
plot(
x,
formula = NULL,
line,
marker = TRUE,
standardize,
legend,
log,
grid = TRUE,
xlab,
ylab,
zlab,
title,
xlim,
ylim,
...
)Arguments
- x
The name of an PM_final data object as a field in a PM_result R6 object, e.g
PM_result$final.- formula
An optional formula of the form
y ~ x, whereyandxare two model parameters to plot in a 3-dimensional bivariate plot. See details.- line
Controls characteristics of lines. This argument maps to plotly line attributes.
TRUEwill plot default lines.FALSEwill suppress lines. If a list, can control many line characteristics, including overriding defaults. Use the plotlyplotly::schema()command in the console and navigate to traces > scatter > attributes > line to see all the ways the line can be formatted. Most common will be:colorLine color.dashPlotting character. Seeplotly::schema(), traces > scatter > attributes > line > dash > values.widthThickness in points.
Example:
line = list(color = "red", dash = "longdash", width = 2)Thelineargument is used to format:the density line drawn over an NPAG PM_final object. Default is
FALSE, which means no density line will be drawn. UseTRUEto draw the default line, which is black, solid, and of width 1, or specify as a list to control these elements, e.g.line = list(color = "red", width = 2, dash = "dash")the drop lines from point to lower surface when a
formulais specified to generate a bivariate plot from an NPAG PM_final object. In this case, default isline = TRUE. The default format is black, dashed, and of width 1.the lines drawing the normal distribution of parameter values from an IT2B PM_Final object. Again, here the default is
line = TRUE, and the format is black, solid, of width 1. See density. Ignored for IT2B output.
- marker
See details for which objects the
markerargument controls. This argument maps to the plotly marker object. It can be boolean or a list.TRUEwill plot the marker with default characteristics.FALSEwill suppress marker plotting. If a list, can control many marker characteristics, including overriding defaults. Use the plotlyplotly::schema()command in the console and navigate to traces > scatter > attributes > marker to see all the ways the marker can be formatted. Most common will be:colorFill color for NPAG bars, marker color for bivariate NPAG plots. Ignored for IT2B plots.symbolPlotting character. Seeplotly::schema(), traces > scatter > attributes > marker > symbol > values. Only relevant for bivariate NPAG plots.sizeCharacter size in points. Only relevant for bivariate NPAG plots.opacityBar fill color for univariate NPAG plots or marker opacity for bivariate NPAG plots. Ignored for IT2B plots. Ranges between 0 (fully transparent) to 1 (fully opaque).lineA list of additional attributes governing the outline for bars in univariate NPAG plots or markers in bivariate NPAG plots. Ignored for IT2B plots.colorOutline color. Default is "black".widthOutline width. Default is 1. Example:marker = list(color = "red", symbol = "triangle", opacity = 0.8, line = list(color = "black", width = 2))
- standardize
Standardize the normal parameter distribution plots from IT2B to the same scale x-axis. Ignored for NPAG output.
- legend
Ignored for this plot.
- log
Boolean operator to plot the y axis in log base 10. This argument maps to the the yaxis type value in the layout object in plotly. Use the plotly
plotly::schema()command in the console and navigate to layout > layoutAttributes > yaxis > type.Example:
log = T- grid
Controls grid display. This argument maps to the xaxis and yaxis layout objects in plotly. Use the plotly
plotly::schema()command in the console and navigate to layout > layoutAttributes > xaxis or yaxis > gridcolor or gridwidth. It is a Boolean operator. IfFALSE, no grid is plotted. IfTRUE, the default color grey and width 1 will be plotted at major tick marks. If a list, color and width can be customized.Examples:
grid = Fgrid = list(gridcolor = "black", gridwidth = 2)
- xlab
Value for x axis label. This argument maps to the the xaxis title element of the layout object in plotly. It can simply be a character vector of length 1 that specifies the name of the axis, or it can be a list for greater control. Use the plotly
plotly::schema()command in the console and navigate to layout > layoutAttributes > xaxis > title to see the ways to customize this axis label. In addition to the plotly attributes, a custom Pmetrics attributeboldmay be included as a list element, either on its own or within the font list. The default forboldisTRUE.Examples:
xlab = "Time (h)"xlab = list(text = "Time", bold = F, font = list(color = "red", family = "Arial", size = 10))xlab = list(text = "Time", font = list(bold = T))
Default is the name of the plotted x-variable. Formatting can be controlled, but the text is recommended to not be changed.
- ylab
Value for y axis label. This argument maps to the the yaxis title element of the layout object in plotly. See
xlabfor details. Ifxlabis specified as a list with formatting, andylabis simply a character label, then the formatting for thexlabwill be applied to theylab. To formatylabindependently, specify a formatting list as forxlab.Default is "Probability" for univariate plots, and the name of the plotted y-variable for bivariate plots. Formatting can be controlled, but the text is recommended to not be changed.
- zlab
Only for bivariate plots. Default is "Probability". Can be a list to control formatting or default text, as for
xlabandzlab.- title
Plot title. This argument maps to the the title layout object in plotly. It can simply be a character vector of length 1 that specifies the name of the plot title, or it can be a list for greater control. Use the plotly
plotly::schema()command in the console and navigate to layout > layoutAttributes > title to see other ways to customize the title using lists as additional arguments. In addition to the plotly attributes, a custom Pmetrics attributeboldmay be included as a list element. The default forboldisTRUE.Examples:
title = "Observed vs. Predicted"title = list(text = "Raw Data", font = list(color = "red", family = "Arial", size = 10, bold = T))
Default is to have no title on plots.
- xlim
Limits of the x axis as a vector. This argument maps to the the xaxis range in the layout object in plotly. Use the plotly
plotly::schema()command in the console and navigate to layout > layoutAttributes > xaxis > range.Example:
xlim = c(0,1)- ylim
Limits of the y axis as a vector. This argument maps to the the yaxis range in the layout object in plotly. Use the plotly
plotly::schema()command in the console and navigate to layout > layoutAttributes > yaxis > range.Example:
ylim = c(0,100)- ...
Other attributes which can be passed to the layout > xaxis/yaxis in a plotly plot to further control formatting. Note that
log,xlab,ylab,xlim, andylimare all controlled by the layout object, but are provided throughout Pmetrics plotly function arguments as shortcuts that map to layout elements. Therefore, the dots argument should be used to specify other aspects of the x axis, y axis, or both. Seeplotly::schema()layout > layoutAttributes > xaxis/yaxis for options. To add to single axis, name it as a list. If attributes are specified without an enclosing xaxis or yaxis list, they will be applied to both axes.Examples:
NPex$data$plot(xaxis = list(tickcolor = "black", tickfont = list(family = "Arial", size = 14, color = "black"))) #applies to x axis onlyNPex$data$plot(linecolor = "red", ticks = "inside") #applies to both axes
.
Details
If formula is omitted, this will generate a marginal plot for each parameter.
For NPAG data, this will be a histogram of marginal values for each parameter and the associated probability
of that value. For IT2B, this will be a series of normal distributions with mean and standard deviation
equal to the mean and standard deviation of each parameter marginal distribution. IF formula IS specified,
this will generate one of two plots.
On the other hand, if formula is two parameters, e.g. CL~V, this will generate a bivariate plot.
For NPAG data, it will be support point with size proportional to the probability
of each point. For IT2B, it will be an elliptical distribution of a bivariate normal distribution centered at the mean
of each plotted variable and surrounding quantiles of the bivariate distribution plotted in decreasing shades of grey.
Mulitvariate normal density code is borrowed from the mvtnorm package.
See also
PM_final, schema
Other PMplots:
plot.MMopt(),
plot.PM_cov(),
plot.PM_cycle(),
plot.PM_data(),
plot.PM_model(),
plot.PM_op(),
plot.PM_pta(),
plot.PM_sim(),
plot.PM_valid()
Examples
library(PmetricsData)
# NPAG
NPex$final$plot()
NPex$final$plot(line = TRUE)
NPex$final$plot(Ke ~ V)
# IT2B
ITex$final$plot()
ITex$final$plot(Ke ~ V)
