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

Weighted ellipses #6186

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

teunbrand
Copy link
Collaborator

This PR aims to fix #5272.

Briefly, it adds a weight aesthetic to stat_ellipse().

I don't know enough about data ellipses to verify the correctness of this approach.

In the example, we can see that the solid, weighted ellipses are shifted to the right because observations to the right have higher weights than those to the left.

devtools::load_all("~/packages/ggplot2")
#> ℹ Loading ggplot2

ggplot(faithful, aes(waiting, eruptions, color = eruptions > 3)) +
  geom_point() +
  stat_ellipse(alpha = 0.3) +
  stat_ellipse(aes(weight = rescale(waiting)))

Created on 2024-11-15 with reprex v2.1.1

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.

Weight parameter for stat_ellipse()
1 participant