Skip to content

annotations aren't plotted properly on log axes #1258

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

Open
cldougl opened this issue Dec 16, 2016 · 11 comments
Open

annotations aren't plotted properly on log axes #1258

cldougl opened this issue Dec 16, 2016 · 11 comments
Labels
bug something broken P3 backlog
Milestone

Comments

@cldougl
Copy link
Member

cldougl commented Dec 16, 2016

Looks like annotations don't show up at the expected coordinates when axes are type: 'log'

example: http://codepen.io/plotly/pen/dOwRyG

@etpinard
Copy link
Contributor

etpinard commented Dec 16, 2016

Unfortunately. you have to Math.log10 the x/y position https://codepen.io/alexcjohnson/pen/yLGPgdE

You shouldn't have to do this, but there's no way for us to fix this is in a backward compatible way.

@etpinard etpinard added the bug something broken label Dec 16, 2016
@etpinard etpinard added this to the v2.0.0 milestone Dec 16, 2016
@ricardovb
Copy link

@etpinard Your solution is wrong ,, you must use: Math.log(x)/ Math.log(10) because Math.log is base E.

@etpinard
Copy link
Contributor

or use Math.log10.

thanks @ricardovb

@tiagobrc
Copy link

The same Bug on Plotly for R. Solved in the same way. Thank you!

@codingbandit
Copy link

Ran into this today - thanks for the workaround!

@alexcjohnson
Copy link
Collaborator

Another option occurred to me while responding to @orenbenkiki's suggestion plotly/dash#916 (comment) - we could imagine adding a new axis attribute like coordinates: 'legacy'|'data' to opt into the "v2" behavior.

@orenbenkiki
Copy link

I actually suggested adding a value to the ref attributes: xref='X' or xref='x!' or xref='x_with_transformations' or something along these lines. Adding a new attribute might be cleaner, though.

@kgdunn
Copy link

kgdunn commented Jul 22, 2021

The above suggestions of using the log of the value to make the annotation do not work either when using log axes and adding an hline with annotation:

fig.add_hline( y=1E6, line_color="red", annotation_text="Lower limit", annotation_position="top left", )
The hline is drawn at the correct place, but the annotation is shown a some monstrously large value on the y-axis. How would one go about fixing this?

@Sank-WoT
Copy link

Here is another example of how poorly log coordinates work:
https://community.plotly.com/t/wrong-annotation-location-of-vrect-on-log-graph/58550/2

@Turakar
Copy link

Turakar commented Sep 19, 2023

Unfortunately. you have to Math.log the x/y position http://codepen.io/etpinard/pen/oYJwLx

You shouldn't have to do this, but there's no way for us to fix this is in a backward compatible way.

Seems like this example is broken by now.

@alexcjohnson
Copy link
Collaborator

Oh that example is using the wrong flavor of log, should be log10 https://codepen.io/alexcjohnson/pen/yLGPgdE - thanks @Turakar

@gvwilson gvwilson self-assigned this Jun 6, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson added the P3 backlog label Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P3 backlog
Projects
None yet
Development

No branches or pull requests