3f39ef5106b08e8c03f7e9e3eaf931eb9c1b0ff4 chmalee Mon Feb 1 14:30:27 2021 -0800 Suppress excess default label (default with new version of R) on bigBarChart and barChart boxplots them since we draw them on manually later anyways, refs #26851 diff --git src/hg/hgc/hgcData/barChartBoxplot.R src/hg/hgc/hgcData/barChartBoxplot.R index 780e905..7f9554b 100644 --- src/hg/hgc/hgcData/barChartBoxplot.R +++ src/hg/hgc/hgcData/barChartBoxplot.R @@ -20,30 +20,32 @@ # old-style vertical bars with labels at a 45 degree angle. Harder to read but saves screen space yLimit <- c(-(max*.02), max+ (max*.03)) par(mar=c(marBottom,marLeft,3,1) + 0.1, mgp=c(2,1,0), font.main=1) exprPlot <- boxplot(value ~ df$category, data=df, ylab=yLabel, ylim=yLimit, main=title, col=colorsHex, border=c(darkgray), # medians medcol="black", medlwd=2, # outliers outcex=.5, outcol=darkgray, # whiskers whisklty=1, whiskcol=gray, # 'staples' staplecol=gray, staplecex=1.3, staplewex=.8, + # with R versions 3.6 and later must suppress x-labels manually + xlab="", # erase X axis labels (add later rotated) names=rep(c(""), count)) y1 <- par("usr")[3] size <- .8 # draw sample count twice (once in color, once in black) to make light colors readable adjust <- .4*abs(y1) text(.4, y1 + adjust, "N=", cex=size, xpd=TRUE) text(1:count, y1 + adjust, exprPlot$n, cex=size, col=colorsHex) text(1:count, y1 + adjust, exprPlot$n, cex=size, col="black") # add sample (X axis) labels at 45 degree angle rot <- 45 size <- 1 text(1:count, y1 - adjust, cex=size, labels=labels, srt=rot, xpd=TRUE, adj=c(1,.5), col="black") text(1:count, y1 - adjust, cex=size, labels=labels, srt=rot, xpd=TRUE, adj=c(1,.5), col=colorsHex) @@ -62,30 +64,32 @@ at=rev(1:nlevels(df$category)), main=title, horizontal=TRUE, space = 0.3, col=colorsHex, border=c(darkgray), # medians medcol="black", medlwd=2, # outliers outcex=.5, outcol=darkgray, # whiskers whisklty=1, whiskcol=gray, # 'staples' staplecol=gray, staplecex=1.3, staplewex=.8, # erase y ticks yaxt="n", + # with R versions 3.6 and later must suppress x-labels manually + xlab="", # erase X axis labels (add later rotated) names=rep(c(""), count)) y1 <- par("usr")[1] # draw numbers only black, at 90 degrees and left-adjusted rot <- 0 adjust <- .15*abs(y1) text(y1 + adjust, rev(1:count), exprPlot$n, cex=size, col="black", srt=rot, adj=0.0) # draw labels size <- .9 adjust <- .4*abs(y1) text(y1-adjust, rev(1:count), cex=size, labels=labels, srt=rot, xpd=TRUE, adj=c(1,.5), col="black") } } drawBarPlot <- function(df) {