You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ggwithinstats绘制配对比较图:如何仅显示箱线图而非小提琴图?

解决ggwithinstats仅保留箱线图的问题

你可以通过以下两种方式实现仅显示箱线图:

方法1:指定绘图类型为箱线图

调用ggwithinstats()时设置plot.type = "box",直接生成纯箱线图:

library(ggstatsplot)

# 以sleep数据集为例的配对比较
ggwithinstats(
  data = sleep,
  x = group,
  y = extra,
  plot.type = "box"
)

方法2:关闭小提琴图显示

如果想保留其他默认配置,仅隐藏小提琴图,设置violin = FALSE即可:

library(ggstatsplot)

ggwithinstats(
  data = sleep,
  x = group,
  y = extra,
  violin = FALSE
)

这两个参数都能达到你要的效果,按需选择即可。

内容的提问来源于stack exchange,提问作者LenaLapi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.18 09:10:23