Plots a trial design plan.
Usage
# S3 method for class 'TrialDesignPlan'
plot(
x,
y,
...,
main = NA_character_,
xlab = NA_character_,
ylab = NA_character_,
type = NA_integer_,
palette = "Set1",
theta = NA_real_,
plotPointsEnabled = NA,
legendPosition = NA_integer_,
showSource = FALSE,
grid = 1,
plotSettings = NULL
)
Arguments
- x
The trial design plan, obtained from
getSampleSizeMeans()
,getSampleSizeRates()
,getSampleSizeSurvival()
,getSampleSizeCounts()
,getPowerMeans()
,getPowerRates()
orgetPowerSurvival()
orgetPowerCounts()
.- y
Not available for this kind of plot (is only defined to be compatible to the generic plot function).
- ...
Optional plot arguments. At the moment
xlim
andylim
are implemented for changing x or y axis limits without dropping data observations.- main
The main title.
- xlab
The x-axis label.
- ylab
The y-axis label.
- type
The plot type (default =
1
). The following plot types are available:1
: creates a 'Boundaries' plot2
: creates a 'Boundaries Effect Scale' plot3
: creates a 'Boundaries p Values Scale' plot4
: creates a 'Error Spending' plot5
: creates a 'Sample Size' or 'Overall Power and Early Stopping' plot6
: creates a 'Number of Events' or 'Sample Size' plot7
: creates an 'Overall Power' plot8
: creates an 'Overall Early Stopping' plot9
: creates an 'Expected Number of Events' or 'Expected Sample Size' plot10
: creates a 'Study Duration' plot11
: creates an 'Expected Number of Subjects' plot12
: creates an 'Analysis Times' plot13
: creates a 'Cumulative Distribution Function' plot14
: creates a 'Survival Function' plot"all"
: creates all available plots and returns it as a grid plot or list
- palette
The palette, default is
"Set1"
.- theta
A vector of standardized effect sizes (theta values), default is a sequence from -1 to 1.
- plotPointsEnabled
Logical. If
TRUE
, additional points will be plotted.- legendPosition
The position of the legend. By default (
NA_integer_
) the algorithm tries to find a suitable position. Choose one of the following values to specify the position manually:-1
: no legend will be shownNA
: the algorithm tries to find a suitable position0
: legend position outside plot1
: legend position left top2
: legend position left center3
: legend position left bottom4
: legend position right top5
: legend position right center6
: legend position right bottom
- showSource
Logical. If
TRUE
, the parameter names of the object will be printed which were used to create the plot; that may be, e.g., useful to check the values or to create own plots with the base Rplot
function. AlternativelyshowSource
can be defined as one of the following character values:"commands"
: returns a character vector with plot commands"axes"
: returns a list with the axes definitions"test"
: all plot commands will be validated witheval(parse())
and returned as character vector (function does not stop if an error occurs)"validate"
: all plot commands will be validated witheval(parse())
and returned as character vector (function stops if an error occurs)
Note: no plot object will be returned if
showSource
is a character.- grid
An integer value specifying the output of multiple plots. By default (
1
) a list ofggplot
objects will be returned. If agrid
value > 1 was specified, a grid plot will be returned if the number of plots is <= specifiedgrid
value; a list ofggplot
objects will be returned otherwise. Ifgrid = 0
is specified, all plots will be created usingprint
command and a list ofggplot
objects will be returned invisible. Note that one of the following packages must be installed to create a grid plot: 'ggpubr', 'gridExtra', or 'cowplot'.- plotSettings
An object of class
PlotSettings
created bygetPlotSettings()
.
Examples
if (FALSE) { # \dontrun{
if (require(ggplot2)) plot(getSampleSizeMeans())
} # }