db643eee1acb462313f15f2ab7570c66238c0205
chmalee
  Thu Mar 18 17:35:44 2021 -0700
Ensure consistent treatment of underscores and spaces in boxplot, refs #27214

diff --git src/hg/hgc/hgcData/barChartBoxplot.R src/hg/hgc/hgcData/barChartBoxplot.R
index ca45a7c..1ed5a3e 100644
--- src/hg/hgc/hgcData/barChartBoxplot.R
+++ src/hg/hgc/hgcData/barChartBoxplot.R
@@ -131,30 +131,33 @@
 # see #22838
 useOldFonts <- (!is.na(args[7]) && args[7]=="1")
 
 if (!useOldFonts && require("showtext",character.only=TRUE, quietly=TRUE)) {
     library(showtext, quietly=TRUE)
     showtext_auto()
     showtext_opts(dpi = 72)
 }
 
 # read colors file
 colorDf = read.table(colorFile, sep="\t", header=TRUE)
 colorsHex <- paste("#",as.character(as.hexmode(colorDf$color)), sep="")
 
 # order categories as in colors file
 df <- read.table(dataFile, sep="\t", header=TRUE)
+# ensure colors df and data df have consistent spacing:
+colorDf$category <- gsub("_", " ", colorDf$category)
+df$category <- gsub("_", " ", df$category)
 df$category <- ordered(df$category, levels=colorDf$category)
 labels <- names(table(df$category))
 count <- length(labels)
 
 # draw graph
 # adjust X label height based on length of labels
 # TODO: scale by number of categories ?
 if (count < DENSECUTOFF) {
     png(file=outFile, width=1070, height=600)
 } else {
     png(file=outFile, width=1070, height=18*count)
 }
 # res=72 is default
 gray <- "#A6A6A6"
 darkgray <- "#737373"