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

Fix geom_hdr_rug() invading guides #35

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

Conversation

teunbrand
Copy link

This PR aims to fix #18.

Briefly, when show.legend = TRUE, the layer is displayed in a legend regardless of whether it has any mapped aesthetics. This caused the geom_hdr_rug()'s key to show up in the alpha guide, despite not mapping alpha. The fix is to set show.legend = NA, which is the default in most layers.

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

ggplot(cars, aes(speed, dist)) +
  geom_hdr() +
  geom_point(color = "red") +
  geom_hdr_rug(aes(fill = after_stat(probs)), length = unit(.2, "cm"), alpha = 1) +
  scale_fill_viridis_d(option = "magma", begin = .8, end = 0)

Created on 2024-08-28 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.

Fix extra guide generated by geom_hdr_rug() when alpha is overriden
1 participant