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

Add example showing how to use the fill argument in stat_function() #4420

Merged
merged 3 commits into from
Nov 9, 2021
Merged

Add example showing how to use the fill argument in stat_function() #4420

merged 3 commits into from
Nov 9, 2021

Conversation

Bisaloo
Copy link
Contributor

@Bisaloo Bisaloo commented Apr 14, 2021

Output:

image

I believe this new example is useful because it might not be straightforward how to use the fill aesthetic with geom_function()/stat_function().

My first try was to simply add fill = "blue" but it doesn't work because the geom_line() doesn't understand fill.

@@ -32,6 +32,8 @@
#'
#' base + stat_function(fun = dnorm, geom = "point", n = 20)
#'
#' base + stat_function(fun = dnorm, geom = "density", color = "blue", fill = "blue", alpha = 0.5)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason why not using geom = "polygon" - it seems more general...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, no specific reason. geom = "density" seemed a little bit more intuitive since the example is about plotting a probability density function. But I have no strong feelings on this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should change it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@thomasp85 thomasp85 merged commit aaaec2f into tidyverse:main Nov 9, 2021
@thomasp85
Copy link
Member

Thanks!

@Bisaloo Bisaloo deleted the fill-stat_function branch November 9, 2021 08:59
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

Successfully merging this pull request may close these issues.

2 participants