e69775942159246bf5aa3aea511f793e1e331b45 jcasper Tue Jan 3 12:43:22 2023 -0800 Telling R to use 6 characters when converting integers into hex for RGB strings, refs #30426 diff --git src/hg/hgc/hgcData/barChartBoxplot.R src/hg/hgc/hgcData/barChartBoxplot.R index bd6dafd..8c108de 100644 --- src/hg/hgc/hgcData/barChartBoxplot.R +++ src/hg/hgc/hgcData/barChartBoxplot.R @@ -127,31 +127,31 @@ dataFile <- args[4] outFile <- args[5] name2 <- args[6] # this argument can be used by QA to check if the new fonts look very different from the old fonts # 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, comment.char="") -colorsHex <- paste("#",as.character(as.hexmode(colorDf$color)), sep="") +colorsHex <- paste("#",format(as.hexmode(colorDf$color), width=6), sep="") # order categories as in colors file df <- read.table(dataFile, sep="\t", header=TRUE, comment.char="") # 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)