You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
annotations aren't plotted properly on log axes #1258
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.
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.
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?
Reacted by Ben Mares, Jonathan O'Connell and Tilman Hoffbauer
Activity
etpinard commentedon Dec 16, 2016
Unfortunately. you have to
Math.log10thex/yposition https://codepen.io/alexcjohnson/pen/yLGPgdEYou shouldn't have to do this, but there's no way for us to fix this is in a backward compatible way.
ricardovb commentedon Sep 28, 2017
@etpinard Your solution is wrong ,, you must use: Math.log(x)/ Math.log(10) because Math.log is base E.
etpinard commentedon Sep 28, 2017
or use
Math.log10.thanks @ricardovb
tiagobrc commentedon Jan 17, 2018
The same Bug on Plotly for R. Solved in the same way. Thank you!
codingbandit commentedon Sep 5, 2019
Ran into this today - thanks for the workaround!
alexcjohnson commentedon Sep 10, 2019
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 commentedon Sep 10, 2019
I actually suggested adding a value to the
refattributes:xref='X'orxref='x!'orxref='x_with_transformations'or something along these lines. Adding a new attribute might be cleaner, though.kgdunn commentedon 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 commentedon Jan 18, 2022
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 commentedon Sep 19, 2023
Seems like this example is broken by now.
alexcjohnson commentedon Sep 19, 2023
Oh that example is using the wrong flavor of log, should be log10 https://codepen.io/alexcjohnson/pen/yLGPgdE - thanks @Turakar