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
Due to setting '"ticklabelindex": -1', the label to the left of the major tick gets drawn (2023 / 2025) instead of the label to right of the major tick (2024 / 2026).
Even though '"ticklabelindex": -1' is set as before, the label to the right of the major tick (2024 / 2026) gets now drawn. This causes some issues for us, as we cannot rely on the ticklabelindex to always work as expected.
There is yet another scenario, where '"ticklabelindex": -1' does not work exactly as expected. Please consider this third codepen (https://codepen.io/stephprobst/pen/LEEKRBK):
In this example, instead of minor ticks we use "ticklabelstep": 2 for a similar layout. I would now have expected the '"ticklabelindex": -1' property to have the same effect as before with the minor ticks: Drawing the label to the left of the major tick (2023 / 2025). But this is not the case.
Why this is relevant:
The behaviour as described above prevents us from creating the following automation:
Makes sure the last visible tick is a major tick
Makes sure the label for the last data point is drawn
For both scenarios we set the tick0 property, but depending on the presence of minor ticks or the distance between the ticks the label behaves differently with `"ticklabelindex": -1' in place (which is our default).
Expected behavior:
The "ticklabelindex": -1 property should behave consistent across all the use cases listed above. In all examples, the labels 2023 and 2025 should be shown.
The text was updated successfully, but these errors were encountered:
It's not straightforward how this issue should be solved. Currently, ticklabelindex determines which minor tick's label should be shown. So when no minor ticks exist (or when their ticklen is 0), the property has no effect.
The expected behavior here is that "ticklabelindex": -1 always draws the label to the left of the major tick. Some alternative solutions for this would be
Make "ticklabelindex": -1 a special case in which extra logic is implemented to draw the label left of the tick.
Change plotly behavior so that labels for minor ticks with "ticklen": 0 are still generated. Then one can make ticklabelindex work with invisible minor ticks.
Add a new property for period axes to specify if the label left or right of the tick should be drawn.
Option 1. is not so nice because it adds a special case. And the index part of the name doesn't make a lot of sense for that special case.
Option 2. requires a little bit of a hack on user side to achieve the desired behavior.
Option 3. seems to be what we want semantically, but might be a little bit confusing because the behavior of ticklabelindex would then depend on how this new property is set.
Problem description:
The current implementation of the
ticklabelindex
property does not work for dticks that span multiple periods when no minor ticks are present.Please consider the following example (https://codepen.io/stephprobst/pen/MYYMjmr):
Due to setting '"ticklabelindex": -1', the label to the left of the major tick gets drawn (2023 / 2025) instead of the label to right of the major tick (2024 / 2026).
This is correct and works as it should. Now let's consider another example, where the minor ticks are not shown (https://codepen.io/stephprobst/pen/RNNzROd):
Even though '"ticklabelindex": -1' is set as before, the label to the right of the major tick (2024 / 2026) gets now drawn. This causes some issues for us, as we cannot rely on the ticklabelindex to always work as expected.
There is yet another scenario, where '"ticklabelindex": -1' does not work exactly as expected. Please consider this third codepen (https://codepen.io/stephprobst/pen/LEEKRBK):
In this example, instead of minor ticks we use
"ticklabelstep": 2
for a similar layout. I would now have expected the '"ticklabelindex": -1' property to have the same effect as before with the minor ticks: Drawing the label to the left of the major tick (2023 / 2025). But this is not the case.Why this is relevant:
The behaviour as described above prevents us from creating the following automation:
For both scenarios we set the
tick0
property, but depending on the presence of minor ticks or the distance between the ticks the label behaves differently with `"ticklabelindex": -1' in place (which is our default).Expected behavior:
The
"ticklabelindex": -1
property should behave consistent across all the use cases listed above. In all examples, the labels 2023 and 2025 should be shown.The text was updated successfully, but these errors were encountered: