GeezerVison is showing github.com — Add spikelines to ternary plots by Lexachoc · Pull Request #8041 · plotly/plotly.js
Conversation
Lexachoc
commented
Sep 14, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Closes #7972
Demo in #7972 (comment)
Similar to Cartesian spikelines, ternary axes support the existing spikeline attributes:
showspikes
spikecolor
spikethickness
spikedash
spikemode
spikesnap
The ternary spikelines also respect spikedistance.
Note: This implementation always displays the corresponding axis value labels (commonlabel) together with the spikelines.
In Cartesian plots, these labels are controlled by hovermode. Ternary plots currently do not have a hovermode option that fits naturally to ternary vertices, and I prefer to always show the labels together with the ternary spikelines instead, which also seems more intuitive for ternary plots. And these labels help the user to quickly understand the axis values.
The axis value labels also respect the axis attribute: hoverformat, so they use the same numeric formatting consistent with the ternary hoverlabel.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Sorry about the force-push! I noticed afterward that the guideline ask not to force-push open PR branches.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks for the PR! Our team will take a look and provide some feedback. No worries about the force push; it's mostly important for after a review starts.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
While testing scatterternarygl (for issue #7058, PR coming soon), I found that the normal hover search already returns a usable point with a finite spikeDistance, but the input pointData.spikeDistance remains Infinity because scattergl returns a new hover point object.
This caused the current ternary spike logic to run a redundant second hoverPoints() search. The next commit will reuse the normal hover result when available and only performs the fallback search when necessary, e.g. when the point is outside hoverdistance but still within spikedistance.
Below is a recording showing the spikelines feature working with a scatterternarygl trace. They work together smoothly without noticeable lag.
spikelines.with.scatterternarygl.trace.mp4
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Lexachoc thanks for submitting this! I was able to dive pretty deep and have to say it works perfectly.
I have a couple of small notes just to ensure the behaviour is consistent between Cartesian/ternary plots. Otherwise, this is great!
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great feature @Lexachoc, thank you for the contribution! 💃
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|