d388bde7f71e98a337eb5c89ddaf7be200d8493c chmalee Thu Mar 18 12:22:13 2021 -0700 Fixing extra definition of xlab in boxplot() function for barChart tracks, refs #27230 diff --git src/hg/hgc/hgcData/barChartBoxplot.R src/hg/hgc/hgcData/barChartBoxplot.R index 7f9554b..870da6e 100644 --- src/hg/hgc/hgcData/barChartBoxplot.R +++ src/hg/hgc/hgcData/barChartBoxplot.R @@ -48,31 +48,31 @@ 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) } else { # new-style vertical bars, easier to read size <- .7 longestLabelIdx = which.max(nchar(labels)) longestLabel = labels[longestLabelIdx] marLeft = nchar(longestLabel)/2.5 # 2.5 was trial and error, strwidth(longestLabel, "inches") didn't work par(mar=c(3,marLeft,2,1) + 0.1, mgp=c(2,1,0), font.main=1) yLimit <- c(-(max*.02), max+ (max*.03)) # by default, the order of horizontal barcharts is reversed compared to vertical barcharts # this is why we inverse the order with at=rev(...) and later for text() apply rev(...) on all y-coords - exprPlot <- boxplot(value ~ df$category, data=df, xlab=yLabel, ylim=yLimit, xlim=c(0, count), + exprPlot <- boxplot(value ~ df$category, data=df, ylim=yLimit, xlim=c(0, count), 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",