autoplot | R Documentation |
ggplot
for Bland-Altman Plot and Regression PlotDraw a ggplot-based difference Bland-Altman plot of reference assay vs. test assay
for BAsummary
object, and a regression plot for MCResult
. Also Providing
the necessary and useful option arguments for presentation.
autoplot(object, ...)
## S4 method for signature 'BAsummary'
autoplot(
object,
type = c("absolute", "relative"),
color = "black",
fill = "lightgray",
size = 1.5,
shape = 21,
jitter = FALSE,
ref.line = TRUE,
ref.line.params = list(col = "blue", linetype = "solid", size = 1),
ci.line = FALSE,
ci.line.params = list(col = "blue", linetype = "dashed"),
loa.line = TRUE,
loa.line.params = list(col = "blue", linetype = "dashed"),
label = TRUE,
label.digits = 4,
label.params = list(col = "black", size = 4),
x.nbreak = NULL,
y.nbreak = NULL,
x.title = NULL,
y.title = NULL,
main.title = NULL
)
## S4 method for signature 'MCResult'
autoplot(
object,
color = "black",
fill = "lightgray",
size = 1.5,
shape = 21,
jitter = FALSE,
identity = TRUE,
identity.params = list(col = "gray", linetype = "dashed"),
reg = TRUE,
reg.params = list(col = "blue", linetype = "solid"),
equal.axis = FALSE,
legend.title = TRUE,
legend.digits = 2,
x.nbreak = NULL,
y.nbreak = NULL,
x.title = NULL,
y.title = NULL,
main.title = NULL
)
object |
( |
... |
not used. |
type |
( |
color , fill |
( |
size |
( |
shape |
( |
jitter |
( |
ref.line |
( |
ref.line.params , ci.line.params , loa.line.params |
( |
ci.line |
( |
loa.line |
( |
label |
( |
label.digits |
( |
label.params |
( |
x.nbreak , y.nbreak |
( |
x.title , y.title , main.title |
( |
identity |
( |
identity.params , reg.params |
( |
reg |
( |
equal.axis |
( |
legend.title |
( |
legend.digits |
( |
A ggplot
based Bland-Altman plot or regression plot that can be
easily customized using additional ggplot
functions.
If you'd like to alter any part that this autoplot
function haven't
provided, adding other ggplot
statements are suggested.
h_difference()
to see the type details.
mcr::mcreg()
to see the regression parameters.
# Specify the type for difference plot
data("platelet")
object <- blandAltman(x = platelet$Comparative, y = platelet$Candidate)
autoplot(object)
autoplot(object, type = "relative")
# Set the addition parameters for `geom_point`
autoplot(object,
type = "relative",
jitter = TRUE,
fill = "lightblue",
color = "grey",
size = 2
)
# Set the color and line type for reference and limits of agreement lines
autoplot(object,
type = "relative",
ref.line.params = list(col = "red", linetype = "solid"),
loa.line.params = list(col = "grey", linetype = "solid")
)
# Set label color, size and digits
autoplot(object,
type = "absolute",
ref.line.params = list(col = "grey"),
loa.line.params = list(col = "grey"),
label.digits = 2,
label.params = list(col = "grey", size = 3, fontface = "italic")
)
# Add main title, X and Y axis titles, and adjust X ticks.
autoplot(object,
type = "absolute",
x.nbreak = 6,
main.title = "Bland-Altman Plot",
x.title = "Mean of Test and Reference Methods",
y.title = "Reference - Test"
)
# Using the default arguments for regression plot
data("platelet")
fit <- mcreg(
x = platelet$Comparative, y = platelet$Candidate,
method.reg = "Deming", method.ci = "jackknife"
)
autoplot(fit)
# Only present the regression line and alter the color and shape.
autoplot(fit,
identity = FALSE,
reg.params = list(col = "grey", linetype = "dashed"),
legend.title = FALSE,
legend.digits = 4
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.