Skip to content

Fix #7875: last period label sometimes not drawn when using negative ticklabelindex - #7937

Draft
my-tien wants to merge 15 commits into
plotly:masterfrom
my-tien:7875-ticklabelindex-last-period
Draft

Fix #7875: last period label sometimes not drawn when using negative ticklabelindex#7937
my-tien wants to merge 15 commits into
plotly:masterfrom
my-tien:7875-ticklabelindex-last-period

Conversation

@my-tien

@my-tien my-tien commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

The period label placement logic always requires two enclosing ticks. Because in the past (before ticklabelindex), period labels only appeared to the right of a tick, plotly added an invisible helper tick before the first visible major tick, so that the period before the first visible tick could be labeled.

With a negative ticklabelindex it's also possible to label the period left of a tick. For that case, in order to label the period after the last visible tick we need a corresponding helper tick after that.
In addition, we need all minor ticks between the first/last visible tick and the major helper tick so that walking ticklabelindex steps from that helper tick lands on the correct minor tick.

my-tien added 15 commits August 4, 2026 16:01
Previously, the ticklabelindex property itself was used in boolean tests which can be confusing.
…tible with minor ticks.

E.g. if major ticks are daily and minor ticks are hourly, tick labels on minor ticks should include hourly information.
…eriod labels

The longer period labels need more space.
by adding an additional major tick at the end of the axis range + all minor ticks between the last visible tick and that helper.
Previously, there was already code that added one major tick and one minor tick before tick0. Now the behavior is symmetrical to the axis range end (1 major tick and all minor ticks between that and tick0).
We need all minor ticks between the first/last visible tick and the major helper tick so that walking ticklabelindex steps from that helper tick lands on the correct minor tick.
This is just to be consistent with the way major ticks are set. In axes_test we test for empty string, instead of for undefined.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant