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

The errorbar cannot be aligned with the bar, if the width of the bar is modified in next-generation interface #2987

Open
liuzj039 opened this issue Sep 1, 2022 · 3 comments

Comments

@liuzj039
Copy link

liuzj039 commented Sep 1, 2022

After changing the width, the errorbar still seems to appear in the original position. Is it necessary to add width parameters to other marks like Range as well?

import seaborn as sns
import seaborn.objects as so
from seaborn import load_dataset
tips = load_dataset("tips")
(
    so.Plot(tips, x='day', y='total_bill', color='sex')
    .add(so.Bar(width=0.3), so.Agg(), so.Dodge(by=['color']))
    .add(so.Range(), so.Est(), so.Dodge(by=['color']))
    .theme(sns.axes_style('ticks'))
)

image

I noticed that there is a gap parameter in Dodge, but it doesn't seem to work for this case.

(
    so.Plot(tips, x='day', y='total_bill', color='sex')
    .add(so.Bar(width=0.3), so.Agg(), so.Dodge(gap=0.5, by=['color']))
    .add(so.Range(), so.Est(), so.Dodge( by=['color']))
    .theme(sns.axes_style('ticks'))
)

image

Please forgive me if I missed something.

@mwaskom
Copy link
Owner

mwaskom commented Sep 3, 2022

Hi, I don't think you've missed anything. width is a bit of a rough edge — it's potentially important for all marks (because it could be needed to dodge properly) but not a relevant property for all marks. ggplot has width of the parameter of position_dodge which I always thought was a little confusing.

Hopefully this will improve as part of addressing #2911, and maybe #2982.

@liuzj039
Copy link
Author

liuzj039 commented Sep 5, 2022

Very much looking forward to the following updates

@mwaskom mwaskom mentioned this issue Oct 30, 2022
5 tasks
@thobanster
Copy link

Following up on this, until this issue gets fixed, how would a user write additional code so as to align the error bar locations with the bars on the barplot?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants