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 ndensity computed group stat to StatBkde2d #61

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

Conversation

seasmith
Copy link

@seasmith seasmith commented Jul 5, 2019

Gives stat_bkde2d() the same behavior as stat_density2d() -- normalizing the density to the max density per group when facetting. Similar to the nlevel computed stat.

Before (density)

library(ggplot2)
library(ggalt) # from seasmith/ggalt branch add-ndensity

ggplot(iris, aes(Sepal.Length, Petal.Length)) +
    stat_bkde2d(aes(fill = stat(density)), geom = "raster", contour = FALSE) +
    facet_wrap(vars(Species))

before-ndensity

After (ndensity)

ggplot(iris, aes(Sepal.Length, Petal.Length)) +
    stat_bkde2d(aes(fill = stat(ndensity)), geom = "raster", contour = FALSE) +
    facet_wrap(vars(Species))

with-ndensity

@hrbrmstr
Copy link
Owner

hrbrmstr commented Jul 5, 2019

Very welcome addition! Can you also add yourself to the DESCRIPTION?

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