-
Notifications
You must be signed in to change notification settings - Fork 11
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
fill not quite right in some gf_dist plots #113
Comments
Actually, the second plot is doing just what ggplot2 thinks you are asking for. So the question is whether we should add something to Here's what's going on in the example above: There are only two groups (TRUE and FALSE), and library(ggformula)
theme_set(theme_bw())
gf_dist("beta", params = list(shape1 = 2, shape2 = 4),
fill = ~(x >= 0.25 & x <= 0.75),
geom = "area", alpha = 0.3) One solution is to use gf_dist("beta", params = list(shape1 = 2, shape2 = 4),
fill = ~cut(x, c(-Inf, 0.25, 0.75, Inf)),
geom = "area", alpha = 0.3) Created on 2018-09-26 by the reprex package (v0.2.0). |
One way to make things easier might be to add a I'll have to think about whether (and how best) to implement something like this. |
Side note: you can avoid the use of library(ggformula)
theme_set(theme_bw())
gf_dist("beta", shape1 = 2, shape2 = 4,
fill = ~cut(x, c(-Inf, 0.25, 0.75, Inf)),
geom = "area", alpha = 0.5) %>%
gf_dist("beta", shape1 = 2, shape2 = 4) Created on 2018-09-26 by the reprex package (v0.2.0). |
Thanks, no big hurry, as my students aren't making these graphs yet. reprex seems quite handy! |
Alternatively, you could do it this way. As bonus you get nice labeling. If you want to further modify the plot, be sure to use library(mosaic)
theme_set(theme_bw())
xpbeta(c(0.25, 0.75), shape1 = 2, shape2 = 4)
Created on 2018-09-27 by the reprex package (v0.2.0). |
I'm going to close this since the behavior is as "expected", ie, just like |
This works well enough:
But this is visibly off:
The text was updated successfully, but these errors were encountered: