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

so.Hist ignores common_norm=True for the "density" aggregate statistic #3633

Open
defiori opened this issue Feb 14, 2024 · 0 comments
Open
Labels

Comments

@defiori
Copy link

defiori commented Feb 14, 2024

Current behaviour

so.Hist ignores common_norm=True for the "density" aggregate statistic. sns.histplot works correctly.

Desired behaviour

so.Hist should take into account common_norm when applying density normalization. The objects interface adds some neat functionality for normalizing per facet. Currently it can't be used with "density".

Examples

I would expect the below examples to produce the same histogram.

(
    so.Plot(
        penguins, 
        x='bill_length_mm', 
        color='species'
    )
    .add(
        so.Bars(), 
        so.Hist(
            stat='density',
            common_norm=True,
        ), 
    )
)

240214_b

sns.histplot(
    data=penguins, 
    x='bill_length_mm', 
    hue='species',
    stat='density',
    common_norm=True,
)

240214_a

Versions

  • seaborn 0.13.2
  • matplotlib 3.8.2
  • pandas 2.2.0
@mwaskom mwaskom added the bug label Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants