R语言 如何删除ggstatsplot包中的点ggwithinstats

svdrlsy4  于 2023-03-10  发布在  其他
关注(0)|答案(1)|浏览(112)

我使用的例子从网站,但我想删除点,使只有连接的中位数仍然存在。
我的准则。

# for reproducibility
set.seed(123)
library(ggstatsplot)

df_disgust <- dplyr::filter(bugs_long, condition %in% c("LDHF", "HDHF"))

p2 <-
  ggstatsplot::ggwithinstats(
    data = df_disgust,
    x = condition,
    y = desire,
    xlab = "Condition",
    ylab = "Desire to kill bugs",
    type = "np",
    conf.level = 0.99,
    title = "Non-parametric Test",
    package = "ggsci",
    palette = "uniform_startrek",
    point.args = list(size = 0, alpha = 0.5),
    point.path = FALSE,
    centrality.plotting = TRUE,
    outlier.tagging = T,
    ggtheme = ggthemes::theme_map()
  )
ggstatsplot::combine_plots(
  plotlist = list(p2),
  plotgrid.args = list(nrow = 2),
  annotation.args = list(
    title = "Effect of disgust on desire to kill bugs ",
    caption = "Source: Bugs dataset from `jmv` R package"
  )
)

负责点的参数,我理解为point.args = list(size = 3, alpha = 0.5),,但当我设置size = 0时,点不会消失。
我没有发现任何其他参数会导致这些点

lyr7nygr

lyr7nygr1#

您可以仅将各个几何层的透明度设置为0。

library(ggstatsplot)

df_disgust <- dplyr::filter(bugs_long, condition %in% c("LDHF", "HDHF"))

ggwithinstats(df_disgust,
  condition,
  desire,
  point.args = list(alpha = 0),
  centrality.point.args = list(alpha = 0),
  point.path = FALSE
)

grouped_ggwithinstats(df_disgust,
  condition,
  desire,
  grouping.var = gender,
  point.args = list(alpha = 0),
  centrality.point.args = list(alpha = 0),
  point.path = FALSE
)

reprex package(v2.0.1.9000)于2022年5月13日创建

相关问题