ggpubr icon indicating copy to clipboard operation
ggpubr copied to clipboard

the order of category in x-axis is not correspond to figure label

Open bioluria opened this issue 10 months ago • 1 comments

myargs <- commandArgs(TRUE)

if (!length(myargs)){
	print("[USAGE] Rscript cptmt_switch.r <demo_table>")
	q()
}

library(ggplot2)
library(ggpubr)
switch_table <- read.delim(myargs[1], as.is=TRUE)
compare <- list(c("A2A", "B2B"), c("A2A", "A2B"), c("A2A", "B2A"), 
	c("B2B", "A2B"), c("B2B", "B2A"), c("A2B", "B2A"))
ggboxplot(data=switch_table, x="Switch", y="GC", palette="Set2", fill="Switch", ylab="GC content (%)", outlier.size=-1, notch=TRUE, legend.title="") + 
ylim(30, 85) + 
theme_pubr(base_size=16, border=TRUE) +
theme(axis.title.x=element_blank()) +
stat_compare_means(comparisons=compare, size=4, tip.length=0)
ggsave("ggpubr_debug.png", width=10, height=7, dpi=600)

input table as follows: demo.xls

output figure as below: xx

Compared to the case without using stat_compare_means, it is speculated that the x-axis should be marked wrong.

bioluria avatar Apr 15 '24 08:04 bioluria