Entering edit mode
8 months ago
fabian
•
0
Hello everyone,
I am trying to plot GSEA results using the gseaplot2 function. I want to plot the top5 highest and lowest NES results. The plotting itself works, however the legend is not in the same order as my results, but ordered alphabetically. I would like the legend to be in the same order as the lower part of the plot. Is there a way to automatically or manually do this? For instance by passing a vector with the labels in the right order to the plot object.
gseaplot2(GSEAresults,geneSetID = rev(c(1:5,(length(GSEAresults$Description)-4):(length(GSEAresults$Description))))
,pvalue_table = FALSE,subplots = 1:2)
ggplot2
automatically order alphabetically, to change that you need to reorder the levels of the element you are plotting.GSEAresults$Description
in your case.GSEAresults$Description <- factor(GSEAresults$Description, levels = c("here you rnew order")