View source: R/ggvpc_standard.r
ggvpc_standard | R Documentation |
Plot basic vpc with 95% PI and observed data. This call is to be extended with for stratification, and axes definition using the layering custom to ggplot2 objects. See the examples below to learn more.
ggvpc_standard(
vpc,
PI = c(0.025, 0.975),
area.col = PI.ci.med.arcol,
linecol.obs.central = PI.real.med.col,
linetype.obs.central = "solid",
linetype.obs.outer = "dashed",
linecol.obs.outer = "darkslategrey",
linesize.obs = 0.5,
alpha = 0.33,
point.shape = 1,
point.size = 1.5,
point.col = "darkslategrey",
yrange.stretch = c(0.9, 1.1),
quiet = TRUE
)
vpc |
output from |
PI |
prediction interval (c(0.025,0.975) for 95% CI) |
area.col |
color of prediction polygon |
linecol.obs.central |
color of observed central lines |
linetype.obs.central |
line type of observed central lines |
linetype.obs.outer |
line type of observed outer lines |
linecol.obs.outer |
line color of observed outer lines |
linesize.obs |
line width of observed data |
alpha |
transparancy scalar (between 0 and 1) |
point.shape |
numeric value for dot shape |
point.size |
numeric value for dot size |
point.col |
color of observed data dots |
yrange.stretch |
vector of c(min,max) which will proportionally rescale the lower and upper limits of the Y axis |
quiet |
whether to suppress process messages |
A ggplot object to be extended optionally
Editing and stratification to be done by adding ggplot layer
nm.read.vpc
, ggvpc_xpose
library(ggplot2)
vpc.all = nm.read.vpc(path = file.path(getOption("qpExampleDir"), "vpc_final_strt"))
ggvpc_standard(vpc.all)
ggvpc_standard(vpc.all) +
labs(x = "Time (h)", y = "Concentration (ng/ml)")
## different Prediction Interval (PI), let's use 90% instead of 95%
ggvpc_standard(vpc.all, PI = c(0.05,0.95)) +
labs(x = "Time (h)", y = "Concentration (ng/ml)")
## logging axes
ggvpc_standard(vpc.all) +
labs(x = "Time (h)", y = "Concentration (ng/ml)") + scale_y_log10() + scale_x_log10()
#modify colors and transparency:
ggvpc_standard(vpc.all, area.col = indigo, alpha = 1, point.shape = 15) +
labs(x = "Time (h)", y = "Concentration (ng/ml)") + scale_y_log10()
## dealing with stratification
myVPC = nm.read.vpc(path = file.path(getOption("qpExampleDir"), "vpc_base_strt"))
p = ggvpc_standard(vpc.all, yrange.stretch = c(1,1))
p = p + labs(x = "Time (h)", y = "Concentration (ng/ml)")
p + facet_wrap(~strata) + scale_y_log10()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.