From 20c50354445769e2c0fa688f04e5dade3556818a Mon Sep 17 00:00:00 2001 From: dicook Date: Wed, 27 Mar 2024 17:13:53 +1100 Subject: [PATCH] small fix so that outliers are not drawn, if there are none --- R/display-xy.r | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/display-xy.r b/R/display-xy.r index f2e7cccd..a4ef5075 100644 --- a/R/display-xy.r +++ b/R/display-xy.r @@ -227,10 +227,12 @@ display_xy <- function(center = TRUE, axes = "center", half_range = NULL, #mdst <- mahal_dist(data, ellipse) anomalies <- which(mdst > ellc) #cat("1 ", length(anomalies), "\n") - points(x[anomalies,], + if (length(anomalies) > 0) { + points(x[anomalies,], col = "red", pch = 4, cex = 2) + } } else message("Check the variance-covariance matrix generating the ellipse\n")