You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But it doesn't work as expected.
I know I could do it creating a x vector and a y vector of points and later using subset....
but how can I achieve it with the "stat" option?
I think it doesn't work, when you add a new area it doesn't respect whatever you did before.
I've also tried with the xmin and xmax option, without success.
It would also be nice to be able to specify two stat functions o values, one for ymax one for ymin, in order to easily paint the are between two curves.
Regards.
The text was updated successfully, but these errors were encountered:
Great, thank you.
I've also figured out that I can mix it with the option "fill = NA" to leave some curves without shading.
Why do you need the first "c(-2,2)"?
Instead of specifying many geom_area sentences, it would be nice to use a single geom_area and define the fill and xlim subregions through a vector or list.
lockbot
locked as resolved and limited conversation to collaborators
Jun 19, 2018
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I would like to create a graph with the normal function from x=-2 to x=2 filled red under the curve from -2 to 0 and blue from 0 to 2.
I've tried
ggplot(NULL,aes(x=c(-2,2))) + geom_area(aes(x=c(-2,0)),stat="function", fun=dnorm, fill="red") +
geom_area(aes(x=c(0,2)),stat="function", fun=dnorm, fill="blue")
But it doesn't work as expected.
I know I could do it creating a x vector and a y vector of points and later using subset....
but how can I achieve it with the "stat" option?
I think it doesn't work, when you add a new area it doesn't respect whatever you did before.
I've also tried with the xmin and xmax option, without success.
It would also be nice to be able to specify two stat functions o values, one for ymax one for ymin, in order to easily paint the are between two curves.
Regards.
The text was updated successfully, but these errors were encountered: