Add support for dashed marker lines in scatter plots #7673
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.
📝 Overview
Introduce support for customising marker line dash patterns in scatter plots, addressing issue #7667.
Currently, the
marker.lineobject only supports properties likecolorandwidth. This PR exposes thedashproperty, allowing users to specify dash styles (e.g., "dash", "dot", "solid") or custom dash lengths for marker borders. This feature is essential for creating clear visual distinctions in scatter plots, such as distinguishing between original and imputed data points, without relying solely on colour or marker symbols.🛠️ Implementation Details
The implementation involves changes across several files to enable the
dashattribute, process it during the calculation step, and render it correctly in both the plot and the legend.Scatter marker line dash support
dashas a supported property in themarker.lineattribute for scatter traces insrc/traces/scatter/attributes.js, including array support.src/traces/scatter/marker_defaults.jsto coercemarker.line.dashvalues, ensuring the property is initialised properly.src/traces/scatter/arrays_to_calcdata.jsto mergemarker.line.dashvalues into the calculated data array (cd) asmld, enabling per-point dash customisation.Rendering updates
drawing.singlePointStylewithinsrc/components/drawing/index.jsto apply the dash pattern to marker outlines. This support both open markers (where the border is the main visual) and closed markers.drawing.dashLineto apply the dash style.src/components/legend/style.jsto includemarker.line.dashin legend item representations, ensuring the legend matches the trace appearance.🚀 Use Case & Example
This feature allow for perfect, fixed-size circles with dashed outlines, which was previously not possible with
markers(only solid lines) orshapes(which distort with axis scaling).Example Usage: (Python)
Closes #7667