我有一个包含三个箱线图的图,我需要使用 ggplot2 或 ggpubr 显示成对箱线图之间的 Spearman 相关性。
制作类似的图很容易,但需要成对的 p 值。例如,
library(ggpubr)
data("ToothGrowth")
df <- ToothGrowth
p <- ggboxplot(df, x = "dose", y = "len",
color = "dose", palette =c("#00AFBB", "#E7B800", "#FC4E07"),
add = "jitter", shape = "dose")
my_comparisons <- list( c("0.5", "1"), c("1", "2"), c("0.5", "2") )
p + stat_compare_means(comparisons = my_comparisons)
如何制作类似的图,但使用 Spearman 相关而不是 p 值?
任何帮助表示赞赏