Skip to content

annotations aren't plotted properly on log axes #1258

Description

@cldougl

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

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

Activity

  1. etpinard commented on Dec 16, 2016

    @etpinard
    Contributor

    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.

  2. added this to the v2.0.0 milestone on Dec 16, 2016
  3. ricardovb commented on Sep 28, 2017

    @ricardovb

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

  4. etpinard commented on Sep 28, 2017

    @etpinard
    Contributor

    or use Math.log10.

    thanks @ricardovb

  5. tiagobrc commented on Jan 17, 2018

    @tiagobrc

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

  6. codingbandit commented on Sep 5, 2019

    @codingbandit

    Ran into this today - thanks for the workaround!

  7. alexcjohnson commented on Sep 10, 2019

    @alexcjohnson
    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.

  8. orenbenkiki commented on Sep 10, 2019

    @orenbenkiki

    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.

  9. kgdunn commented on Jul 22, 2021

    @kgdunn

    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?

  10. Sank-WoT commented on Jan 18, 2022

    @Sank-WoT

    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

  11. Turakar commented on Sep 19, 2023

    @Turakar

    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.

  12. alexcjohnson commented on Sep 19, 2023

    @alexcjohnson
    Collaborator

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

  13. self-assigned this
    on Jun 6, 2024
  14. removed their assignment
    on Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogbugsomething broken

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions