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
Shapes are misplaced when using numbers as categoryarray values #5767
If X axis type is category, and categoryarray contains (string type) numbers, then shapes are horizontally misplaced, as x0 and x1 values in the shape are not considered as items, but as indices of the categoryarray.
This makes it so that getCategoryIndex is not called even when the value is a string that looks like a number (e.g., "40"). @alexcjohnson is this behaviour desired?
Ok I see. Setting autotypenumbers: "strict" in layout or layout.xaxis (relevant to this use case) doesn't fix the bug, but to be fair the docs just mention "trace data" and not the coordinates of shapes (or images or annotations for that matter). But the expected behaviour is most likely to follow what the axis' autotypesnumbers setting says to do for shapes as well.
Yep, that sounds right - if an axis is in strict mode, that should apply to shapes, annotations, and images as well as traces. So that part of this issue can be considered a bug.
Activity
nicholas-esterer commentedon Aug 3, 2021
This seems to be due to the behaviour of the package
fast-isnumeric, which is used inplotly.js/src/plots/cartesian/set_convert.js
Line 182 in 2f17e11
Indeed, in a
nodejsconsole:This makes it so that
getCategoryIndexis not called even when the value is a string that looks like a number (e.g., "40").@alexcjohnson is this behaviour desired?
nicholas-esterer commentedon Aug 3, 2021
also related: #5741
alexcjohnson commentedon Aug 3, 2021
See also
autotypenumbers: 'strict'#5240alexcjohnson commentedon Aug 3, 2021
(which is now the default for graphs made with plotly.py)
nicholas-esterer commentedon Aug 3, 2021
Ok I see. Setting
autotypenumbers: "strict"inlayoutorlayout.xaxis(relevant to this use case) doesn't fix the bug, but to be fair the docs just mention "trace data" and not the coordinates of shapes (or images or annotations for that matter). But the expected behaviour is most likely to follow what the axis'autotypesnumberssetting says to do for shapes as well.alexcjohnson commentedon Aug 3, 2021
Yep, that sounds right - if an axis is in strict mode, that should apply to shapes, annotations, and images as well as traces. So that part of this issue can be considered a bug.