diff --git a/DESCRIPTION b/DESCRIPTION index 3940522..60351b8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: ampvis2 Type: Package Title: Tools for visualising amplicon data Description: ampvis2 is a small set of tools that allows effortless visualisation of amplicon data. -Version: 2.8.6 +Version: 2.8.7 Authors@R: c( person( c("Kasper", "Skytte"), "Andersen", diff --git a/R/amp_boxplot.R b/R/amp_boxplot.R index 1469475..46a98a8 100644 --- a/R/amp_boxplot.R +++ b/R/amp_boxplot.R @@ -153,21 +153,20 @@ amp_boxplot <- function(data, } ## plot the data - if (group_by == sampleIDvarname) { - p <- ggplot(abund7, aes(x = Display, y = Sum)) + if (!is.null(order_group)) { + abund7$.Group <- factor(abund7$.Group, levels = rev(order_group)) } - if (group_by != sampleIDvarname) { - if (!is.null(order_group)) { - abund7$.Group <- factor(abund7$.Group, levels = rev(order_group)) - } + if (all(group_by %in% sampleIDvarname)) + p <- ggplot(abund7, aes(x = Display, y = Sum)) + else p <- ggplot(abund7, aes(x = Display, y = Sum, color = .Group)) - } p <- p + guides(col = guide_legend(reverse = TRUE)) + xlab("") + theme_classic() + theme( + legend.title = element_blank(), panel.grid.major.x = element_line(color = "grey90"), panel.grid.major.y = element_line(color = "grey90") )