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

seaborn.objects.Plot can't realize bivariate distribution #3805

Closed
moonlighthalfwindow opened this issue Dec 21, 2024 · 1 comment
Closed

Comments

@moonlighthalfwindow
Copy link

fig = plt.figure()
ax = fig.add_subplot(111)
p = (
    so.Plot(tips, x='tip', color='sex')
    .add(so.Bar(alpha=1), so.Hist(), so.Stack())
    .label(color='')
    .on(ax)
    .plot(pyplot=True)
)
p.show()

image

The y parameter passed in when Hist is called has no effect, it will have no effect on the graphing, it will simply generate a y-axis label and cannot generate a bivariate distribution.
I'm looking forward to the implementation of this feature.

@mwaskom
Copy link
Owner

mwaskom commented Jan 26, 2025

Correct, this isn't implemented currently.

It would not be implemented as it is in sns.histplot because it doesn't make sense to portray a 2D histogram with a Bar mark. There would need to be (1) a Hist2D (or similar) Stat transform and (2) a suitable Mark, e.g. a heatmap mark. There's not currently a well defined way for Stat transforms to introduce a variable that is then mapped by one of the properties (i.e. the count would typically be mapped to the color; but you could also do something like use a Dot mark and map the count to dotsize).

Closing as not a bug.

@mwaskom mwaskom closed this as completed Jan 26, 2025
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

No branches or pull requests

2 participants