温馨提示:本文翻译自stackoverflow.com,查看原文请点击:r - How to change the order of boxplots in ggboxplot?
boxplot ggpubr r

r - 如何在ggboxplot中更改框线图的顺序?

发布于 2021-02-03 01:16:40

以下是我目前拥有的可创建下图的代码。我改为尝试制作一个图形,其中蓝色框形图(双关)在x轴的标题“双关”下彼此相邻,在黄色框形图“ mv”旁边。

ggboxplot(
  d, x = "Condition.Name", y = c("pun", "mv"), 
  merge = TRUE, palette = "jco",
  title = NULL,
  xlab = '',
  ylab = ''
  )

图形

查看更多

提问者
samf94
被浏览
22
Chuck P 2020-10-09 23:59

正在使用,mtcars因为您没有提供数据。你需要combinemergeggpubr::ggboxplot

library(ggpubr)
#> Loading required package: ggplot2
ggboxplot(
   mtcars, 
   x = "am", 
   y = c("disp", "hp"),
   combine = TRUE,
   color = c("#0073C2FF", "#EFC000FF", "#0073C2FF", "#EFC000FF"),
   title = NULL,
   ylab = ''
)