首页 > 解决方案 > ggbetweenstats中的点颜色

问题描述

有没有办法改变ggbetweenstats中的点颜色?我检查了文档,没有看到可以简单更改点颜色的参数。我尝试了 ggplot2::scale_fill_manual(values = c(purple,darkred,blue)) 但什么也没发生。

已识别出三种颜色,详细代码如下:

ggbetweenstats(
  data = box.dat, 
  x = Class, 
  y = Pre_NeoAts,
  notch = T,
  outlier.tagging = F,
  messages = FALSE,
  mean.color = "black",
  mean.size = 3
)   +   ggplot2::scale_fill_manual(values = c(purple,darkred,blue))                              

谁能给我一个提示?非常感谢先进!

标签: rggplot2

解决方案


这是更改点颜色的方法。(这是与ggstatsplot 0.0.6,目前在CRAN

ggstatsplot::ggbetweenstats(
  data = iris,
  x = Species,
  y = Sepal.Length,
  messages = FALSE,
  mean.color = 'black'
) +
  ggplot2::scale_color_manual(values = c("#999999", "#E69F00", "#56B4E9"))

此外,您还可以palettepackage选择更改颜色中指定,而不是手动指定它们:

ggstatsplot::ggbetweenstats(
  data = iris,
  x = Species,
  y = Sepal.Length,
  messages = FALSE,
  palette = "Royal1",
  package = "wesanderson"
)

reprex 包(v0.2.1)于 2018 年 10 月 10 日创建


推荐阅读