Browse code

fix issue with wrongly label groups in DataTrack #74

Robert Ivánek authored on 17/02/2023 14:31:09
Showing 2 changed files

... ...
@@ -937,7 +937,7 @@ setMethod("drawGD", signature("DataTrack"), function(GdObject, minBase, maxBase,
937 937
     vals <- values(GdObject)
938 938
     groups <- .dpOrDefault(GdObject, "groups")
939 939
     if (!is.null(groups) && length(groups) != nrow(vals)) {
940
-        stop("'groups' must be a vector of similar length as the number of rows in the data matrix (", nrow(vals), ")")
940
+        stop("'groups' must be a vector of the same length as the number of rows in the data matrix (", nrow(vals), ")")
941 941
     }
942 942
     if (!is.null(groups) && !is.factor(groups)) {
943 943
         groups <- factor(groups)
... ...
@@ -1620,10 +1620,8 @@ addScheme <- function(scheme, name) {
1620 1620
     } else { ## Otherwise colors are being mapped to group factors
1621 1621
         if (!is.factor(groups)) {
1622 1622
             groups <- factor(groups)
1623
-            nms <- unique(groups)
1624
-        } else {
1625
-            nms <- levels(groups)
1626 1623
         }
1624
+        nms <- levels(groups)
1627 1625
         col <- .dpOrDefault(GdObject, "col", lattice::trellis.par.get("superpose.line")$col)
1628 1626
         col <- rep(col, nlevels(groups))[seq_along(levels(groups))]
1629 1627
         col.line <- rep(.dpOrDefault(GdObject, "col.line", col), nlevels(groups))[seq_along(levels(groups))]