'why are there colors and comparisons missing?

I'm using this command via ggstatsplot:

ggbetweenstats(
  data = df_sub
  , x = Generator
  , y = hours
  , outlier.tagging  = TRUE
  , map_signif_level = TRUE
  , ggsignif.args    = list(textsize = 4, tip_length = 0.01)
  , results.subtitle = TRUE) + 
  theme_bw() +
  guides(fill=guide_legend("Class"))

and receive this plot:

img

which is fine, except that those three group levels to the right are missing data points and colors. In addition, some statistical comparisons/tests are missing, or? E.g., the one far to the right is compared only once.

I cropped the image slightly as the data is confidential.



Solution 1:[1]

Some discrete color scales only have just a few available colors. The default color scheme hue has more colors:

ggbetweenstats(
  data = df_sub,
  x = Generator, 
  y = hours,
  outlier.tagging  = TRUE,
  map_signif_level = TRUE,
  ggsignif.args    = list(textsize = 4, tip_length = 0.01),
  results.subtitle = TRUE
  ) + 
  theme_bw() +
  scale_color_hue() +
  guides(fill=guide_legend("Class")

To have more control over the tests to make you can just use the underlying packages ggpubr and ggplot2.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 danlooo