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

Annotations don't align with the bars if I use "category" axis type. #5741

Closed
kei51e opened this issue Jun 18, 2021 · 3 comments
Closed

Annotations don't align with the bars if I use "category" axis type. #5741

kei51e opened this issue Jun 18, 2021 · 3 comments

Comments

@kei51e
Copy link

kei51e commented Jun 18, 2021

Plotly version: 2.0.0
Example Pen: https://codepen.io/kei51/pen/xxqBdWW

Annotations align with bars nicely if I don't set any type to X-axis.

image

They don't align if I set the "category" axis type to X-axis.

image

It works fine with plotly 1.52.2.

@nicolaskruchten
Copy link
Member

This is indeed awkward: categories are automatically mapped to integers starting at 0, so your "1" category is actually at x=0. On the other hand, annotation x positions are always interpreted as numbers, so your x="1" annotation is in fact placed at x=1.

We don't have a good workaround for this at the moment, sorry.

cc @alexcjohnson we were just talking about this the other day :)

@kei51e
Copy link
Author

kei51e commented Jun 18, 2021

I see. I confirmed that works. Thanks!

@gvwilson
Copy link
Contributor

Hi - we are trying to tidy up the stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for several years, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. Thanks for your help - @gvwilson

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

3 participants