Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing boxes with mean values in ggwithinstats #860

Open
ramashka328 opened this issue May 17, 2023 · 2 comments
Open

Removing boxes with mean values in ggwithinstats #860

ramashka328 opened this issue May 17, 2023 · 2 comments

Comments

@ramashka328
Copy link

Hey,

how can I remove all or several of the boxes with mean values from ggwithinstats plot? Or what is the easiest way of making boxes with mean values to not overlap the boxplots?

@ludist
Copy link

ludist commented Mar 21, 2024

The boxes with mean values, described more generally as centrality labels, can be manipulated with the "centrality.label.args" parameter which passes the parameters to the underlying ggplot2 functions responsible for creating visuals.

In the ggwithinstats R file, the following parameter example is given:
centrality.label.args = list(size = 3, nudge_x = 0.4, segment.linetype = 4)

By changing the nudge_x value, you should be able to prevent overlapping.

I'm sure there's a more elegant way to do this, but if you want to quickly remove any element that's based on a parameter that passes info down to a ggplot2 function, you can make it invisible with:
alpha = 0.0,

You can learn more about how to manipulate the appearance of objects by looking at the ggplot2 documentation.

@ludist
Copy link

ludist commented Mar 21, 2024

It turns out the more elegant solution is to use ggplot2's "element_blank" function, nicely explained here:
https://rpubs.com/Mentors_Ubiqum/ggplot_remove_elements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants