Eva Janoušková
Eva Janoušková

Reputation: 23

Increase font size of inplot mean for ggbetweenstats (R) but not write it over the plots

If you use the code below to increase the font size of inplot means, the means are written over the plots (see the picture in answer in Increase font size of inplot mean for ggbetweenstats from ggstatsplot). I would like to increase the font size, but still have the means next to the plots as in the picture in question in Increase font size of inplot mean for ggbetweenstats from ggstatsplot). Is that possible?

library(ggstatsplot)

ggbetweenstats(
  data = iris,
  x = Species,
  y = Sepal.Length,
  title = "Distribution of sepal length across Iris species",
  centrality.label.args = list(size  = 8)
)

Upvotes: 0

Views: 604

Answers (1)

Quinten
Quinten

Reputation: 41457

You can use the nudge_x or nudge_y argument to specify where the label should be. Maybe you want something like:

library(ggstatsplot)
ggbetweenstats(
  data = iris,
  x = Species,
  y = Sepal.Length,
  title = "Distribution of sepal length across Iris species",
  centrality.label.args = list(size  = 7, nudge_y = 1.5)
)

Output:

enter image description here

Keep in mind that because of the really big font size, it is hard to place the labels in a clean way. You can manually change the argument if you want.

Upvotes: 1

Related Questions