Closed vertesy closed 3 years ago
shistogram(Total.Starter.Expr.per.cell) [1] 11 [1] 2222 [1] "/Users/abel.vertesy/Dropbox/Abel.IMBA/AnalysisD/Abel/CON/p2.v2020.11.premRNA./RabV.Filter/Total.Starter.Expr.per.cell.hist.pdf" [1] 22222
shistogram <- function(vec, ext = "pdf", xlab = F, vline = F, plot = TRUE, ...) { plotname <- as.character(substitute(vec)) if(isFALSE(xlab)) xlab = plotname df <- qqCovert.hist(namedVec = vec) p <- gghistogram(data = df, x = "value" , title = plotname, xlab = xlab , add = "median" , color = "names", fill = "names" , palette = 'jco', ... ) + if (length(unique(df$"names")) == 1) theme(legend.position = "none") if (vline) p <- p + geom_vline(xintercept = vline) fname = kpp(plotname, "hist", ext) print(11) qqSave(ggobj = p, title = plotname, fname = fname) print(1121) # if (plot) p } # ------------------------------------------------------------------------------------------------ qqSave <- function(ggobj, ext =c("png", "pdf")[2], w =4, h = w , title = F, fname = F, ...) { if(isFALSE(title)) title = substitute(ggobj) if(isFALSE(fname)) fname <- kpp(title, ext) print(2222) print(paste0(getwd(),"/", fname)) print(22222) # cowplot::save_plot(plot = ggobj, filename = fname, base_height = w, base_width = h) ggsave2(plot = ggobj, filename = fname, height = w, width = h) } Total.Starter.Expr.per.cell <- colSums(EXPR.XXgenes[genes.primary.cells, ]) shistogram(Total.Starter.Expr.per.cell)
This was due to trying to print all bar labels, when a vector e.g. has a 1000 names, or each unique. Now a warning is raised and some fix implemented
Keeps hanging forever
Does not matter which saving