observablehq / plot

A concise API for exploratory data visualization implementing a layered grammar of graphics
https://observablehq.com/plot/
ISC License
4.16k stars 171 forks source link

markerEnd and variable aesthetics #2093

Closed Fil closed 1 day ago

Fil commented 1 month ago

When using markerEnd on a line with variable aesthetics, the marker is shown on each and every segment:

Capture d’écran 2024-06-17 à 11 13 02

This seems wrong, and it would be better to apply markerStart only on the first segment, and markerEnd only the last segment. marker should also probably be applied more sparingly to avoid duplications between the end of a segment and start of the following segment.

There is a work-around, but it doesn't feel great:

Capture d’écran 2024-06-17 à 11 14 13

see https://observablehq.com/@observablehq/plot-whirlpool-arrows

mbostock commented 1 month ago

Seems like applyGroupedMarkers should be able to do the “right thing” with respect to groups.