Write QC line lables to ggplot QC Charts. Useful if you want to see the value of the center line and QC limits. see method argument for methods supported.
This function has been largely replaced by setting stat_QC(auto.label=T) when you specify stat_QC. However, there may be times when stat_QC_labels() provides you with additional control.
stat_QC_labels(mapping = NULL, data = NULL, geom = "label",
position = "identity", na.rm = FALSE, show.legend = NA,
inherit.aes = TRUE, n = NULL, digits = 1, method = "xBar.rBar",
color.qc_limits = "red", color.qc_center = "black", text.size = 3, ...)
n: number, for
digits integer, indicating the number of decimal places
method : string, calling the following methods:
color.qc_limits : color, used to colorize the plot’s upper and lower mR control limits.
color.qc_center : color, used to colorize the plot’s center line.
text.size : number, size of the text label
…: other arguments passed on to layer. These are often aesthetics, used to set an aesthetic to a fixed value, like color = “red” or size = 3. They may also be parameters to the paired geom/stat.
# Setup Data --------------------------------------------------------------
set.seed(5555)
Process1 <- data.frame(processID = as.factor(rep(1,100)),
metric_value = rnorm(100,0,1),
subgroup_sample=rep(1:20, each=5),
Process_run_id = 1:100)
INDV <- ggplot(Process1, aes(x=Process_run_id, y = metric_value)) +
geom_point() + geom_line()
INDV
INDV + stat_QC(method="XmR") +
stat_QC_labels(method="XmR")
INDV + stat_QC(method="XmR") +
stat_QC_labels(method="XmR", color.qc_center = "blue")
INDV + stat_QC(method="XmR") +
stat_QC_labels(method="XmR", color.qc_limits = "green")
INDV + stat_QC(method="XmR") +
stat_QC_labels(method="XmR", text.size = 4)