Skip to content

Commit

Permalink
Resolves #25
Browse files Browse the repository at this point in the history
No-names add up problem  qbarplot seem to add up data in the final element
  • Loading branch information
vertesy committed Jan 16, 2022
1 parent 8ca7119 commit eca5762
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/ggExpress.R
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ qbarplot <- function(vec, ext = "pdf", plot = TRUE


if (isFALSE(xlab)) xlab = plotname
df <- qqqCovert.named.vec2tbl(namedVec = vec, strip.too.many.names = F)
df <- qqqCovert.named.vec2tbl(namedVec = vec, strip.too.many.names =F)
# nrCategories.DFcol1 <- length(unique(df[,1])); stopif( nrCategories.DFcol1 >100)

if (length(unique(df$"names")) == 1) df$"names" <- as.character(1:length(vec))
Expand All @@ -197,6 +197,7 @@ qbarplot <- function(vec, ext = "pdf", plot = TRUE
, palette = palette_use, ...
) + ggpubr::grids(axis = 'y')

if (length(vec) > max.names) p <- p + ggplot2::guides(x = 'none')
if (hide.legend) { p <- p + ggplot2::theme(legend.position = "none"
, axis.text.x = ggplot2::element_text(angle = xlab.angle, hjust = 1) )
}
Expand Down Expand Up @@ -611,7 +612,7 @@ qqqCovert.named.vec2tbl <- function(namedVec=1:14, verbose = F, strip.too.many.n

# Check naming issues
nr.uniq.names <- length(unique(names(namedVec)))
if (nr.uniq.names > thr & verbose) print("Vector has", thr, "+ names. Can mess up auto-color legends.")
if (nr.uniq.names > thr & verbose) iprint("Vector has", thr, "+ names. Can mess up auto-color legends.")
if (nr.uniq.names < 1 & verbose) print("Vector has no names")
an.issue.w.names <- (nr.uniq.names > thr | nr.uniq.names < 1 )

Expand Down

0 comments on commit eca5762

Please sign in to comment.