Skip to content

Annotations referenced to the y-axis are in the wrong place, for log-scales #6880

Closed
@RichardNeill

Description

@RichardNeill

If I have:

  • a point at value y=3
  • an annotation at value y=3, with yref=y
    then the annotation is attached to the point, as expected.

But If I then make the y-axis have type=log, then the annotation comes adrift from the point.
https://codepen.io/RichardNeill/pen/dyreyMG

What's happening is that the annotation is being drawn in linear units - it isn't truly referenced to the yaxis, because if you read across, the y-value for the annotation is 10E3, not 3.

This might be a problem to fix, given that it would be backward-incompatible - see #420.
If so, please at least consider warning about this issue at: https://plotly.com/javascript/text-and-annotations/
A suitable message might be:

Note, for backward compatibility, annotations are drawn in linear units. So if your axis-type is log, remember to use:
yref:y, y:Math.log10(your_y_value)

Thanks :-)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions