Skip to content

Add scatterternarygl trace - #8083

Open
Lexachoc wants to merge 6 commits into
plotly:mainfrom
Lexachoc:feature-scatterternarygl
Open

Lexachoc wants to merge 6 commits into
plotly:mainfrom
Lexachoc:feature-scatterternarygl

Conversation

@Lexachoc

@Lexachoc Lexachoc commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Closes #7058

Ternary diagrams are widely used in materials science, for example for glass compositions (shown in #7058) and multicomponent phase diagrams. Platforms such as the Materials Project use interactive Plotly-based phase diagram for multicomponent materials systems.

This PR adds a new scatterternarygl trace type for rendering ternary scatter plots with WebGL.

It reuses the existing scattergl rendering logic and adds ternary-specific coordinate handling, clipping, hover/select support, strict bundle support, schema/types, regl precompiled commands, tests (to be added), and image mocks.

The goal is to provide a WebGL-based alternative to scatterternary, especially for larger datasets (thousands) showing in #7058.

Ternary diagrams are widely used in materials science, for example for glass compositions (as shown in #7058) and multicomponent phase diagrams.

Platforms such as the Materials Project use Plotly-based phase diagrams for multicomponent materials systems, while materials data platforms such as SciGlass Next also work with large glass composition datasets where ternary visualization is very useful.

This PR adds a new scatterternarygl trace type for rendering ternary scatter plots with WebGL.

It reuses the existing scattergl rendering logic and adds ternary-specific coordinate handling, clipping, hover/select support, strict bundle support, schema/types, regl precompiled commands, tests (to be added), and image mocks.

The goal is to provide a WebGL-based alternative to scatterternary, especially for larger datasets with thousands of points, as shown in #7058.


Current limitation

There is no hoveron attribute for scattergl. Since scatterternarygl reuses much of the scattergl implementation, it will not support hoveron either. I have no intention of supporting it specifically in this PR, as this should be addressed upstream.

@Lexachoc
Lexachoc force-pushed the feature-scatterternarygl branch from 6f072c6 to 1d66cc2 Compare September 25, 2026 23:39
@Lexachoc

Copy link
Copy Markdown
Contributor Author

I’ll add the jasmine tests after the initial review, so I can incorporate any feedback or requested changes first. If there are any specific tests you’d like to see covered, please let me know.


One known issue is some visible aliasing/jagged edges in the WebGL rendering. I’ll add a comparison screenshot below to show the difference more clearly. Feedback on whether this should be addressed in this PR would be very helpful.

(Same data from the example page: Soil Types Ternary Plot)

image

@Lexachoc

Copy link
Copy Markdown
Contributor Author

It would be helpful if #8041 could be reviewed first, so this PR can also include the ternary spikeline support from that work.
I’ve tested the two changes together locally, and the initial result looks good so far (if I haven't missed anything).

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.

[FEATURE]: Add scatterternarygl trace for ternary plot

1 participant