-
Notifications
You must be signed in to change notification settings - Fork 190
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
pairwise display disappears when limiting y-axis #966
Comments
The only way you can have your cake (display pairwise comparisons) and eat it too (and not display axes labels for values that are not observed in the data) is to hide axes labels: library(ggstatsplot)
library(ggplot2)
max(mtcars$wt)
#> [1] 5.424
ggbetweenstats(mtcars, cyl, wt) + scale_y_continuous(labels = c(0:5, NA))
#> Scale for y is already present.
#> Adding another scale for y, which will replace the existing scale. Created on 2024-10-22 with reprex v2.1.1 |
Hi again! Just popping by quickly to let you know that I was looking at your solution before and unfortunately it completely shifts the graph up so that the datapoints are no longer where they're supposed to be (the mean of the group with 4 cylinders is 2.29, but it appears in 1.29 in the y-scale). What kinda worked (there is still graph there, but at least no number or anything to mark it) in my code was just adding a blank space:
But trying this solution out in the mtcars data shows the same problem of shifting the y-axis upwards. I tried the following code, but then I reproduced the same issue as with my graph (that it shows the NA).
|
Hello! I think you can probably just set your range of labels using the When you set |
Hi! Terribly sorry if this has already been asked or has a simple solution. I didn't find it in the issues section. ggbetweenstats seems to add values to the y-axis even beyond the limit of the variable. I added code to limit the y-axis values, however, that then makes the pairwise comparisons above disappear. I already tried 3 ways to limit the y-axis and they all make it disappear. Do you have a solution for that? Thanks in advance.
My code:
ggbetweenstats( data = ds3_clean_90, x = condition_concept_fact, y = Schuldfaehigkeit_um, type = "parametric", # ANOVA or Kruskal-Wallis var.equal = TRUE, # ANOVA or Welch ANOVA plot.type = "box", pairwise.comparisons = TRUE, pairwise.display = "significant", centrality.plotting = TRUE, centrality.label.args = list(size = 3, nudge_x = 0.4, nudge_y = 0.2, segment.linetype = 4, min.segment.length = 0), bf.message = FALSE, xlab = "Conceptualization", ylab = "Culpability", p.adjust.method = "bonferroni" ) + ggplot2::scale_y_continuous( limits = (c(0, 5)))
Plot with no y-axis limit
Plot once y-axis limit is added
The text was updated successfully, but these errors were encountered: