Skip to content

Markers

A marker defines a graphic drawn on vertices of a line or link mark.

02004006008001,0001,2001,4001,6001,8002,0002,2002,4002,600↑ deathsApr1854JulOctJan1855AprJulOctJan1856Fork
js
Plot.plot({
  marks: [
    Plot.ruleY([0]),
    Plot.lineY(crimea, {x: "date", y: "deaths", stroke: "cause", marker: "circle"})
  ]
})

The supported marker options are:

  • markerStart - the marker for the starting point of a line segment
  • markerMid - the marker for any intermediate point of a line segment
  • markerEnd - the marker for the end point of a line segment
  • marker - shorthand for setting the marker on all points

The following named markers are supported:

  • none (default) - no marker
  • arrow - an arrowhead with auto orientation
  • arrow-reverse - an arrowhead with auto-start-reverse orientation
  • dot - a filled circle without a stroke and 2.5px radius
  • circle, equivalent to circle-fill - a filled circle with a white stroke and 3px radius
  • circle-stroke - a hollow circle with a colored stroke and a white fill and 3px radius
  • tick ^0.6.12 - a small opposing line
  • tick-x ^0.6.12 - a small horizontal line
  • tick-y ^0.6.12 - a small vertical line

If marker is true, it defaults to circle. If marker is a function, it will be called with a given color and must return an SVG marker element.

The primary color of a marker is inherited from the stroke of the associated mark. The arrow marker is automatically oriented such that it points in the tangential direction of the path at the position the marker is placed. The circle markers are centered around the given vertex.

For lines whose curve is not linear, markers are not necessarily drawn at the data positions given by x and y; marker placement is determined by the (possibly Bézier) path segments generated by the curve. To ensure that symbols are drawn at a given x and y position, consider using a dot mark instead.