Closed PhyloGrok closed 4 years ago
Hi @PhyloGrok, Yes it is automatically sorted based on T cell abundance.
The easiest way around this is to take the results from imsig
function, sort them back to the order you want and plot them yourself.
Another option is to use the function below. Just add an additional line in the place I have pointed out to sort your files and use it to generate a similar plot to what you have shared.
plot_abundance <- function(exp, r = 0.6){
cell <- imsig(exp, r)
# write a line to sort the samples back into the order you want.
cell$samples <- row.names(cell)
cell$samples <- factor(cell$samples, levels = cell$samples)
plots = lapply(1:(ncol(cell)-1), function(x) ggplot(cell, aes(x = cell$samples, y = cell[,x]))
+ geom_bar(stat = "identity") + theme_classic() +
theme(axis.title.x=element_blank(), axis.text.x=element_blank(), axis.title.y=element_blank())+
ggtitle(colnames(cell)[x]))
do.call(grid.arrange, plots)
}
Thanks!
Hello, it seems like the bar plot readouts for plot_abundance are sorted from some global average of low score -> high score. However, my samples are from a timecourse, I would like to see them in the correct order. I tried re-naming the samples by number, alphabetical order, etc. but they always sort by least to greatest average score. Is there an option to change this within the plot_abundance() function?