Closed tsievert closed 5 years ago
Hi Trolske, thanks for the opening the issue and providing a reproducible examples.
As far as I can tell, all you have to do is remove the scale_y_continuous(limits = ...)
from the call
ggplot(data = .df3, aes(x = factor(x), y = y)) +
stat_boxplot(geom = "errorbar", width = 0.5) +
geom_boxplot() +
facet_wrap( ~ s) +
# scale_y_continuous(limits = c(3.2, 4.29), expand = expand_scale(mult = c(0.05, 0.025))) +
xlab("") +
ylab("") +
ggtitle("Postnatal subset") +
theme_bw(base_size = 14, base_family = "sans") +
theme(panel.spacing = unit(0.3, "lines"), plot.title = element_text(size=14)) +
geom_signif(data=pairwise.p,
aes(xmin=start, xmax=end, annotations=label, y_position=y),
textsize = 3,
manual=TRUE)
#> Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
Created on 2019-04-01 by the reprex package (v0.2.1)
Now, of course the question is why? And to be honest, right now I have no idea...
This seems to be a genuine bug
I have found out where the bug was (https://github.com/const-ae/ggsignif/commit/f0f9738ebf0b271d55d2bfb7a1deef4be335decf) and fixed it.
.plot2 <- ggplot(data = .df3, aes(x = factor(x), y = y)) +
stat_boxplot(geom = "errorbar", width = 0.5) +
geom_boxplot() +
facet_wrap( ~ s) +
scale_y_continuous(limits = c(3.2, 4.29), expand = expand_scale(mult = c(0.05, 0.025))) +
xlab("") +
ylab("") +
ggtitle("Postnatal subset") +
theme_bw(base_size = 14, base_family = "sans") +
theme(panel.spacing = unit(0.3, "lines"), plot.title = element_text(size=14)) +
geom_signif(data=pairwise.p,
aes(xmin=start, xmax=end, annotations=label, y_position=y),
textsize = 3,
manual=TRUE)
#> Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
print(.plot2)
Created on 2019-04-01 by the reprex package (v0.2.1)
To get the latest version with the bug fix, you have to install it from GitHub
devtools::install_github("const-ae/ggsignif")
In addition, I will try to push a new version to CRAN in the next weeks.
I will close this issue for now. If I missed anything feel free to comment and thanks again for discovering the bug.
Hey,
first of all thanks for the great package! I already used it several times for non-faceted plots without any issue.
However, I'm constantly getting
#Warning: Removed 2 rows containing non-finite values (stat_signif).
but I can't pinpoint where I went wrong. I tried to follow your example code as closely as possible .Thanks in advance!
Your example:
My code: