Skip to content

Marks Reference ​

Observable Plot marks for creating chart layers.


What are Marks? ​

Marks are the visual elements that display your data. Each mark type represents data differently:

yaml
marks:
  - type: line        # Draw a line
  - type: dot         # Add dots at data points
  - type: text        # Add labels

Basic Marks ​

dot ​

Points at x,y coordinates.

yaml
marks:
  - type: dot
    x: date
    y: value
    r: 4              # Radius
    fill: category    # Fill color by field

line ​

Connected line through points.

yaml
marks:
  - type: line
    x: date
    y: value
    stroke: category  # Line color by field
    strokeWidth: 2

area ​

Filled area under a line.

yaml
marks:
  - type: area
    x: date
    y: value
    fill: "steelblue"
    opacity: 0.5

bar / barY / barX ​

Bars from baseline to value.

yaml
marks:
  - type: barY
    x: category
    y: value
    fill: category

rect ​

Rectangles with explicit bounds.

yaml
marks:
  - type: rect
    x1: start
    x2: end
    y1: 0
    y2: value

text ​

Text labels.

yaml
marks:
  - type: text
    x: date
    y: value
    text: label       # Field containing text
    fontSize: 12

Rule Marks ​

rule / ruleX / ruleY ​

Reference lines.

yaml
marks:
  - type: ruleY
    y: 50             # Horizontal line at y=50
    stroke: "red"
    strokeDasharray: "4 2"

tick / tickX / tickY ​

Short tick marks.

yaml
marks:
  - type: tickX
    x: date
    y: value

Statistical Marks ​

box / boxY / boxX ​

Box plot (quartiles and outliers).

yaml
marks:
  - type: boxY
    x: category
    y: value

regression ​

Linear regression line.

yaml
marks:
  - type: dot
  - type: regression
    x: x
    y: y
    stroke: "red"

Interactive Marks ​

crosshair ​

Show coordinates on hover.

yaml
marks:
  - type: line
  - type: crosshair

tip ​

Tooltip on hover.

yaml
marks:
  - type: dot
  - type: tip
    title: name

Special Marks ​

cell ​

Grid cells for heatmaps.

yaml
marks:
  - type: cell
    x: month
    y: day
    fill: value

waffle ​

Waffle chart cells.

yaml
marks:
  - type: waffle
    y: value
    fill: category

density ​

2D density estimation.

yaml
marks:
  - type: density
    x: longitude
    y: latitude

contour ​

Contour lines for density.

yaml
marks:
  - type: contour
    x: x
    y: y
    thresholds: 20

hexbin ​

Hexagonal binning.

yaml
marks:
  - type: hexbin
    x: x
    y: y
    fill: "count"

Network Marks ​

Lines connecting nodes.

yaml
marks:
  - type: link
    x1: source_x
    y1: source_y
    x2: target_x
    y2: target_y

arrow ​

Directional arrows.

yaml
marks:
  - type: arrow
    x1: from_x
    y1: from_y
    x2: to_x
    y2: to_y

vector ​

Direction and magnitude.

yaml
marks:
  - type: vector
    x: x
    y: y
    rotate: angle
    length: magnitude

Layout Marks ​

frame ​

Border around plot area.

yaml
marks:
  - type: frame
    stroke: "gray"

gridX / gridY ​

Grid lines.

yaml
marks:
  - type: gridY
    stroke: "#eee"

axisX / axisY ​

Custom axis configuration.

yaml
marks:
  - type: axisX
    ticks: 5
    tickFormat: ".0f"

Geographic Marks ​

geo ​

Geographic shapes (requires projection).

yaml
marks:
  - type: geo
    geometry: geometry
    fill: value

sphere ​

Globe background.

yaml
marks:
  - type: sphere
    fill: "lightblue"

graticule ​

Latitude/longitude grid.

yaml
marks:
  - type: graticule
    stroke: "#ddd"

Mark Options ​

Common options available on most marks:

OptionTypeDescription
x, ystringPosition channels
x1, x2, y1, y2stringRange bounds
fillstring/colorFill color
strokestring/colorStroke color
strokeWidthnumberLine thickness
strokeDasharraystringDash pattern
opacitynumberTransparency (0-1)
rnumber/stringRadius (dots)
rotatenumber/stringRotation angle
fontSizenumberText size
fontWeightstringText weight
textstringText field
titlestringTooltip text
filterfunctionData filter
sortobjectSort order

Combining Marks ​

Layer multiple marks for rich visualizations:

yaml
marks:
  # Background area
  - type: areaY
    x: date
    y: value
    fill: "steelblue"
    opacity: 0.2

  # Main line
  - type: line
    x: date
    y: value
    stroke: "steelblue"
    strokeWidth: 2

  # Data points
  - type: dot
    x: date
    y: value
    fill: "steelblue"
    r: 3

  # Reference line
  - type: ruleY
    y: 50
    stroke: "red"
    strokeDasharray: "4 2"

  # Crosshair interaction
  - type: crosshair

See Also ​

Released under the MIT License. Built by Boundary Lab.